View Single Post
Old 04-15-2012, 07:26 AM   #54
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,746
Default

Quote:
Originally Posted by Tale View Post
I can't seem to directly return an instance variable anymore, i.e.:

Code:
function osc()
  instance(x, y)
(
  y = sin(x);
  x += 1/srate;
  y; // Error
);
If I change it like this it works fine:

Code:
0 + y; // OK
Interestingly it breaks again if I do y + 0 instead of 0 + y.

It doesn't matter if I use the this keyword instead of instancing the variables. However, if I declare y a local instead of an instance variable, then all is well.

EDIT: I have found another example where an instance variable doesn't work, while a local or global variable does work:

Code:
function foo(x)
  instance(y, z)
(
  y = x;
  loop(y, // Error
    z += 2;
  );
);
This time 0 + y also doesn't work, but y|0 does.
Thanks for spotting this, updated the build with a fix.

Last edited by Justin; 04-15-2012 at 07:46 AM.
Justin is online now   Reply With Quote