Skip to content
soliton4 edited this page Dec 7, 2014 · 4 revisions

#track - type modifier

Stability: 3 - Stable

requires

[dynamic type safety](dynamic type safety)

keep track of the lifetime of a instance.

##destroy (a destructor)

  class type track MyClass {
    destroy: function(){
      console.log("destructor called");
    }
  };
  
  function someFun(){
    MyClass a = new MyClass();
    a = new MyClass(); // destroy of the prior instance is called
    // destroy is called at the end of the function because a is no longer referenced
  };

promiseLand will keep track of references to your instance. once the last reference is gone, the destroy function gets called.

achievement

have a destructor at your disposal. use the Resource Acquisition Is Initialization pattern.

you may want to continue reading the sync modifier.

Clone this wiki locally