Aha... I agree that's a bit weird. Perhaps lines like these:
On 22 Apr 2009, at 21:01, Stefan Blixt wrote:The problem is really that 'chuck' accepts
Compilers can't always be expected to understand every kind of error, and that error message isn't the worst I've seen :) Still, if the opportunity os there to change it to something better, now harm done. The situation can be translated to this:
int x;
1 => x[1];
which gives the same subscript error message. Hans's code is otherwise without problems - ChucK allows (like many other languages) to reuse a variable identifier in a new block, so x can be redeclared as an int in the inner while loop, overshadowing the outer x which is an array.
Then when a line after that is added
x[msg.which] => int x;it complains about this line, giving that cryptic message, despite the fact that it is correct.
x[msg.which] => int x0;
When the first line is accepted, that gives the impression that this name overloading is legal, though it differs from C++. Thus I started to use it.
Chuck needs to make up its mind: is this name overloading legal or not. If it is not, it should always be rejected.
Hans
_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users