Fellow ChucKists,
Below you'll find some example code proving that extending a array of instances of a home-made class using ".size()"doesn't properly instantiates the new objects, leading to nullpointers and the shred being dropped. The "<<" operator, using "new" does lead to proper instantiation.
I feel this is a bug.
Yours,
Kas.
=====================8<==============================
//instantiate a array of home made classes
foo bar[1];
//check that this works
<<<"your lucky number is ", bar[0].value>>>;
//grow by one.
bar << new foo ;
//make sure it's instantiated
<<<"your lucky number is ", bar[1].value>>>;
//grow by a another one
bar.size(bar.size() + 1);
//make sure we did, size should now be 3
<<<"size is now", bar.size()>>>;
//try to verify this is instantiated, it won't be
<<<"your unlucky number is ", bar[2].value>>>;
class foo
{
Std.rand2(0, 10) => int value;
}
===================================================