[chuck-users] Object array initialization

Ge Wang gewang at CS.Princeton.EDU
Thu Jul 13 12:47:46 EDT 2006


Hi Joerg!

> i also experienced problems with it that were solved when i declared
> each element of the new array as a single variable and the @=> to the
> array-elements.
> instead of
>
> obj o[4];
>
> i had to write:
> obj o1;
> obj o2;
> obj o3;
> obj o4;
>
> obj @ o[4];
> o1 @=> o[0];
> o2 @=> o[1];
> ...

Is the offending declaration nested inside a class or function 
definition?
They seem to be working for me, so I suspect there might be other forces
of chuck at work here.

Another workaround, instead of declaring each element, you might try
the new operator (though it could be subject to the same bug as above):

obj @ o[4];
for( int i; i < o.cap(); i++ )
     new obj @=> o[i];

Sorry for the troublesome bug.  We will take a deeper look into this.
If you can pinpoint a demonstrative program (short as possible) that
behaves incorrectly with these issues, it would help quite a bit.

Best,
Ge!



More information about the chuck-users mailing list