Are we able to ensure that Promises can be sub-typed right now? Did not see things in the spec about this.
In Chome/V8: function MyPromiseType() { var self=this; Promise.call(this, function (f,r) { self.f = f; self.r = r; }); } MyPromiseType.prototype = Object.create(Promise.prototype); new MyPromiseType() TypeError: Failed to construct 'Promise': Please use the 'new' operator, this DOM object constructor cannot be called as a function. And if we do sub-type a promise, that seems to be the only way to hook into state propagation for promises (according to A+). This means that anything wishing to have state propagation must have Promise in the prototype chain. This seems fine to me, but means modifying existing prototype chains must start from the beginning of the chain rather than being able to add a Promise interface on top of the end of the chain. For example with the prototype chain: Game -> CardGame -> BlackJackGame We could not turn the BlackJack type into a promise correct? Just trying to understand at this point.
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss