[chuck-users] Object array initialization

joerg piringer joerg at piringer.net
Sat Jul 15 10:49:16 EDT 2006

hi Ge,
i was trying to reproduce the error and was not quite successful.
but i run into the following problem:
i am @=>ing a new object to an array and then trying to spork a member 
function of that object array.
i get an array out of bounds exception when sporking. the assignment 
works fine.
see the attached script...

i think this is somehow related to the earlier problem.


Ge Wang wrote:
> 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!
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: arrayinitdebuga.ck
Url: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20060715/147398f6/attachment.bat 

More information about the chuck-users mailing list