Re: SubTyping Promise?

2014-02-10 Thread Andreas Rossberg
On 8 February 2014 21:43, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Yes, but it also depends upon Promise[Symbol.create] being implemented. Right. V8 has not yet implemented @@create yet (and it will likely take some time until it does, since it's a rather intrusive feature). /Andreas

SubTyping Promise?

2014-02-08 Thread Bradley Meck
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 =

Re: SubTyping Promise?

2014-02-08 Thread Allen Wirfs-Brock
On Feb 8, 2014, at 10:47 AM, Bradley Meck wrote: 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;

RE: SubTyping Promise?

2014-02-08 Thread Domenic Denicola
-discuss Subject: Re: SubTyping Promise? err, missing word On Feb 8, 2014, at 11:07 AM, Allen Wirfs-Brock wrote: ... The magic is in the Promise[Symbol.create] method which is inherited by MyPromise and invoked during (new MyPromise). Playing around with the instance side prototype chain

Re: SubTyping Promise?

2014-02-08 Thread Allen Wirfs-Brock
On Feb 8, 2014, at 12:09 PM, Domenic Denicola wrote: In practice, this means that (sticking to ES5 syntax), you need to do ```js MyPromise.__proto__ = Promise; ``` Yes, but it also depends upon Promise[Symbol.create] being implemented. ___