-
Notifications
You must be signed in to change notification settings - Fork 2
track
soliton4 edited this page Dec 7, 2014
·
4 revisions
#track - type modifier
Stability: 3 - Stable
[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.
have a destructor at your disposal. use the Resource Acquisition Is Initialization pattern.
you may want to continue reading the sync modifier.
found any errors?
missing something?
let me know