[chuck-users] A Bug? or is it a Feature?

Mike McGonagle mjmogo at gmail.com
Tue Jan 24 14:10:40 EST 2006


Hello all,

I was playing with some ChucK code that I wrote, and in copying some
of the code to another file, I inadvertantly copied a global variable
definition so that it was after a function that referenced that global
variable. When I ran the code, I didn't get a message from ChucK that
the variable was not defined when the code was compiled, and when the
program ran, it would hang at the location where the global was
referenced. (I don't have access at the moment to a running "ChucK",
so I can only give an simple example.)


fun void mySporkedFunction(float p1, float p2) {
   <<< p1, p2 >>>;
   globalVariable * 2 => float myLocalVariable;
   // do some sort of time function here
}

// define the global here
10.0 => float globalVariable;

spork ~ mySporkedFunction(0.0, 1.0);


When I ran my actual code, Chuck would hang up at the point where the
globalVariable was referenced, in this example, that would be the
second line off mySporkedFunction. The previous "print" statement
would not output anything, until I hit Control-C to stop everything.

Needless to say, I moved the global defintion to before the function,
but I would think that there should be some sort of error message
generated, or this should work as expected.

Thanks,

Mike


More information about the chuck-users mailing list