On 6/10/07, eduard aylon
Hi list,
I am trying to make a list of objects where each object has references to other objects, but I am not succeeding and I get a NullPointerException. The piece of code below may represent what I am trying to do.
One more reply to this, it might be obvious by now but I needed a workaround
myself and was happy to find one, if a ugly one. Here's a edited version of
the original demonstration code that gets around the bug. clearly this isn't
going to work if the length of the array isn't defined in the code but is
instead determined by the outcome of some opperation. Right now I don't
think it's possible to have ChucK generate names for class instances as
ChucK can't generate ChucK code, then run it. Somebody kindly corect me if I
overlooked something in that regard. This would get quite anoying if -say-
50 "Items" were needed but if a dozen or so would do this might get people
by untill this is fixed in a future version.
Yours,
kas.
==========================
class object
{
Std.rand2f(0., 1.) => float f_;
}
class Item extends object
{
2 => int size_;
object item_[size_];
fun void print()
{
for( 0=>int i; i