[chuck-users] Inner loop array index bug

Hans Aberg haberg at math.su.se
Thu Apr 23 04:13:03 EDT 2009


On 23 Apr 2009, at 07:42, Stefan Blixt wrote:

> Aha... I agree that's a bit weird. Perhaps lines like these:
>
> y => int z;
>
> are seen as an initialization of z, where y can be taken from the  
> outer scope, and not treated the same as
>
> int z;
> y=> z;

It might be possible. When reading
   int x[256];
   ...
   while(kb.recv(msg)) {
     x[msg.which] => int x;
     x[msg.which] => int x0;
   }
the first definition in the inner environment defines a new "x". Then,  
on the next definition, that x is used, because it covers the global  
"x". So, since it is not an array, one gets the index error.

   Hans




More information about the chuck-users mailing list