Fixing `Promise.resolve()`

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Jun 10 14:11:12 UTC 2015


Revised definition of Promise.resolve:

25.4.4.5	Promise.resolve ( x )
The resolve function returns either a new promise resolved with the passed argument, or the argument itself if the argument is a promise produced by this constructor.

1.	Let C be the this value.
2.	If Type(C) is not Object, throw a TypeError exception.
3.	If IsPromise(x) is true,
     a.	Let xConstructor be Get(x, "constructor").
     b.	ReturnIfAbrupt(xConstructor).
     c.	If SameValue(xConstructor, C) is true, return x.
4.	Let promiseCapability be NewPromiseCapability(C).
 5.	ReturnIfAbrupt(promiseCapability).
6.	Let resolveResult be Call(promiseCapability.[[Resolve]], undefined, «x»).
7.	ReturnIfAbrupt(resolveResult).
8.	Return promiseCapability.[[Promise]].

So far, no changes to any other Promise static methods

Allen





On Jun 9, 2015, at 10:19 PM, Axel Rauschmayer wrote:

> Is there any way to find out how this works *now*? I can’t find the May 2015 meeting notes, either.
> 
> Do all static Promise methods now just use `this` (e.g. `Promise.all()` → `this.promiseResolve(···)`)? Or only `Promise.resolve()`?
> 
> Thanks!
> 
> Axel
> 
> 
>> On 02 Jun 2015, at 23:28, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>> 
>> 
>> On Jun 2, 2015, at 2:01 PM, Mark S. Miller wrote:
>> 
>>> Hi Scott,
>>> 
>>> If the change is as simple as it appears, it seems it will go into ES6 itself!
>> 
>> The fix has already been made to the production copy that will be released in a couple weeks when we have ECMA GA approval
>> 
>> Allen
>> 
>> 
>> 
>>> 
>>> Thanks for pushing this forward.
>>> 
>>> 
>>> On Tue, Jun 2, 2015 at 1:25 PM, C. Scott Ananian <ecmascript at cscott.net> wrote:
>>> Thanks!  It looks like core-js has already patched in the new spec: https://github.com/zloirock/core-js/issues/75
>>> 
>>> I've opened https://github.com/paulmillr/es6-shim/issues/344 on es6-shim, and I'll see if I can get a patch together for it.
>>> 
>>> I've filed https://bugzilla.mozilla.org/show_bug.cgi?id=1170742 against Mozilla.
>>> I've filed https://code.google.com/p/v8/issues/detail?id=4161 against v8.
>>> 
>>> Allen: Will this be an errata to ES6, part of ES7, or "something else"?
>>>   --scott
>>>>>> 
>>> 
>>> 
>>> -- 
>>>     Cheers,
>>>     --MarkM
>> 
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
> 
> -- 
> Dr. Axel Rauschmayer
> axel at rauschma.de
> rauschma.de
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150610/98bdf05c/attachment.html>


More information about the es-discuss mailing list