chuck icon indicating copy to clipboard operation
chuck copied to clipboard

the time is now: fix class static variables

Open gewang opened this issue 6 months ago • 3 comments

class Foo
{
    5 => static int x;
    static SinOsc y;
    new SndBuf @=> SndBuf @ z;
}

possible semantics and process:

  1. identify lines with static variables
  2. disallow both static and non-static variables in the same line
  3. disallow time-advance (could be a compiler error or a runtime exception for immediate mode violation) (e.g., 1::second => static dur a => now;)
  4. run the static lines a) at compile-time if public class OR b) at run-time if non-public class
int x;

fun int bar()
{
    return x+5;
}

class Foo
{
    bar() => static int z;
}

gewang avatar Jan 11 '24 23:01 gewang