View Single Post
Old 04-14-2012, 02:52 PM   #49
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,721
Default

OK, a new build is up as of April 14. Changes:
  • Fixed potential function issues on 64 bit
  • Local variables are now stored separately by section to avoid potential threading issues (i.e. if a function is declared in @init, and has local(x), x will be a different var when used from @init vs @sample vs @gfx etc).
  • You can access instance variables via the "this." prefix. So for example:
    Code:
    function f() 
    (
      this.test = 1;
    );
    whatever.f(); // sets whatever.test = 1
    This syntax also allows nesting:
    Code:
    function f() ( this.test = 1; );
    function g() 
    ( 
      this.obj1.f(); 
      this.obj2.f(); 
      this.obj1.test - this.obj2.test;
    );
    
    a = whatever.g(); // a is now 0
  • You can still use instance() to declare access to member variables, but internally it translates these variables into "this.<whatever>". If you use instance(a), you can also then access a, a(), a.variable, a.variable.sub, or a.function() as members. Example modification of the above code:
    Code:
    function f() instance(test) ( test = 1; );
    function g() instance(obj1 obj2)
    ( 
      obj1.f(); 
      obj2.f(); 
      obj1.test - obj2.test;
    );
    
    a = whatever.g(); // a is now 0
  • You can use "this..whatever" to access the parent's namespace (or this...whatever for two parents up).. For example:
    Code:
    function a() 
    ( 
      this..test=1; 
    ); 
    some.object.a(); // sets some.test=1
  • Probably fixed/broke other things, did a lot of internal cleanups... We'll release the new version of EEL2 on git once this settles down.

I'm still planning on adding a JS-specific @include syntax, so we can include common code, but I'm just getting these language features sorted before doing that (i.e. if we need to change syntax, I don't want to encourage TOO much code to be written this way).

Last edited by Justin; 04-14-2012 at 05:15 PM.
Justin is offline   Reply With Quote