domenic at domenicdenicola.com (2014-02-24T21:08:35.678Z)
On Feb 18, 2014, at 11:38 PM, C. Scott Ananian wrote: > So the code above would work in a fully-compliant ES6 implementation. > The question is: what should it do in the weird "not quite ES6, but > more than ES5" implementations that are shipping today. This isn't an > ES6 spec issue, it's a challenge to implementors to provide > forward-compatibility. Right, that's what I was trying to say. It all depends upon the new operator invoking @@create. It wouldn't work on an partial ES6 implementation where Promise.@@create was missing or where 'new' did not invoke @@create.
On Feb 18, 2014, at 11:38 PM, C. Scott Ananian wrote: > [resending to list, original was sent from wrong address and got bounced] > > On Tue, Feb 18, 2014 at 11:12 AM, Allen Wirfs-Brock > <allen at wirfs-brock.com> wrote: >> On Feb 18, 2014, at 12:44 PM, C. Scott Ananian wrote: >>> ```js >>> var SubPromise = function(exec) { Promise.call(this, exec); ... }; >>> Object.setPrototypeOf(SubPromise, Promise); >>> SubPromise.prototype = Object.create(Promise.prototype); >>> SubPromise.prototype.constructor = SubPromise; >>> ``` >>> Note that `SubPromise` inherits `Promise.@@create` and so this code >>> will work fine in an ES6 environment. (Blame @domenic, he showed me >>> that this should work!) > ... >> It wouldn't work in an implementation where Promise was natively implemented according to the ES6 Promise spec but where 'new SubPromise(exec)' did not include a call to SubPromise.@@create. > > ... > So the code above would work in a fully-compliant ES6 implementation. > The question is: what should it do in the weird "not quite ES6, but > more than ES5" implementations that are shipping today. This isn't an > ES6 spec issue, it's a challenge to implementors to provide > forward-compatibility. Right, that's what I was trying to say. It all depends upon the new operator invoking @@create. It wouldn't work on an partial ES6 implementation where Promise.@@create was missing or where 'new' did not invoke @@create. Allen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140219/3b48ec24/attachment.html>