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. best joerg 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@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- http://joerg.piringer.net http://www.transacoustic-research.com http://www.iftaf.org http://www.vegetableorchestra.org/ 1 => int newnum; class Loop { newnum => int num; newnum++; function void playLoop() { while(true) { <<< num >>>; 500::ms => now; } } } <<< "starting loops..." >>>; 4 => int maxloop; Loop @ loop[maxloop]; int lnr; for(0 => lnr; lnr < loop.cap(); lnr++) { <<< "new loop",lnr >>>; new Loop @=> loop[lnr]; // uncomment mr. spork to see the weirdness //spork ~ loop[lnr].playLoop(); } <<< "loops started" >>>; while(true) { 10::ms => now; }