You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like not deleting or resetting deferred._super and deferred._props after valueOf() is done could lead to odd behavior, e.g. if someone should happen to hold a reference to the deferred created by def("MyClass") and do something that invokes valueOf() a second (or third, or fourth…) time, unexpected things could happen to the prototype.
While this example is a bit contrived who knows what odd things might occur in real use:
def ("Person") ({
init: function(name){
this.name = name;
},
speak: function(text){
alert(text || "Hi, my name is " + this.name);
}
});
var NinjaDef = def ("Ninja");
NinjaDef << Person ({
init: function(name){
this._super();
},
kick: function(){
this.speak("I kick u!");
}
});
Person ({
guns: true
});
// This is a bit contrived, but... who knows what odd thing could happen to cause valueOf() to run
NinjaDef + 5;
var ninjy = new Ninja("JDD");
console.log("ninjy.name: ", ninjy.name); // should be JDD
console.log("ninjy.guns: ", ninjy.guns); // Ninjas don't use guns!
The text was updated successfully, but these errors were encountered:
It seems like not deleting or resetting deferred._super and deferred._props after valueOf() is done could lead to odd behavior, e.g. if someone should happen to hold a reference to the deferred created by def("MyClass") and do something that invokes valueOf() a second (or third, or fourth…) time, unexpected things could happen to the prototype.
While this example is a bit contrived who knows what odd things might occur in real use:
The text was updated successfully, but these errors were encountered: