Promise finally
Jordan Harband
ljharb at gmail.com
Sun Feb 25 03:27:55 UTC 2018
Simply theorizing about how it might be done - without an actual spec diff
(this email might be close but I can't personally reason about it) - isn't
going to achieve much, unfortunately.
However, if you'd like to make a PR to the proposal repo, I'd be happy to
review it. If it seems possible, and if it passes the test suites, I'd be
happy to make the corresponding PR to the actual spec and test262.
(as for "waiting a year", ES is a living standard; there's no need to wait
that long. If a change is presented that results in fewer observable calls
without violating any of the criteria that led to the current spec, I
suspect the committee and implementors would be more than happy to see the
change go in ASAP)
On Sat, Feb 24, 2018 at 1:22 AM, Raul-Sebastian Mihăilă <
raul.mihaila at gmail.com> wrote:
> Trying better formatting for esdiscuss.org.
>
> ```
> CreateResolvingFunctions(promise, finallySourcePromise)
> update step 3: Let resolve be CreateBuiltinFunction(stepsResolve, «
> [[Promise]], [[AlreadyResolved]], [[FinallySourcePromise]] »).
> insert new step 6: Set resolve.[[FinallySourcePromise]] to
> finallySourcePromise.
>
> GetCapabilitiesExecutor Functions
> A GetCapabilitiesExecutor function is an anonymous built-in function
> that has a [[Capability]] and a [[FinallySourcePromise]] internal slots.
>
> NewPromiseCapability(C, finallySourcePromise = undefined)
> update step 5: Let executor be CreateBuiltinFunction(steps, «
> [[Capability]], [[FinallySourcePromise]] »).
> insert new step 7: Set executor.[[FinallySourcePromise]] to
> finallySourcePromise.
>
> Promise ( executor )
> insert step 8: Let finallySourcePromise be undefined.
> insert setp 9: If executor has a internal slot [[FinallySourcePromise]]
> Let finallySourcePromise be executor.[[FinallySourcePromise]]
> update step 8 (which now becomes step 10): Let resolvingFunctions be
> CreateResolvingFunctions(promise, finallySourcePromise).
>
> PromiseResolveThenableJob(promiseToResolve, thenable, then,
> finallySourcePromise)
> The job PromiseResolveThenableJob with parameters promiseToResolve,
> thenable, then and finallySourcePromise performs the following steps:
> update step 1: Let resolvingFunctions be CreateResolvingFunctions(promiseToResolve,
> finallySourcePromise).
>
> Promise.prototype.finally(onFinally)
> Let promise be the this value.
> If IsPromise(promise) is false, throw a TypeError exception.
> Let C be ? SpeciesConstructor(promise, %Promise%).
> Let resultCapability be ? NewPromiseCapability(C, promise).
> Return PerformPromiseThen(promise, onFinally, onFinally,
> resultCapability).
>
> Promise Resolve Functions
> update step 7: If Type(resolution) is not Object, then
> Let finallySourcePromise be F.[[FinallySourcePromise]]
> If finallySourcePromise is undefined
> return FulfillPromise(promise, resolution).
> Else
> If finallySourcePromise.[[PromiseState]] is "rejected"
> return RejectPromise(promise, finallySourcePromise.[[Promise
> Result]])
> Else
> return FulfillPromise(promise, finallySourcePromise.[[Promise
> Result]])
> update step 12: Perform EnqueueJob("PromiseJobs",
> PromiseResolveThenableJob, « promise, resolution, thenAction,
> F.[[FinallySourcePromise]] »).
> ```
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180224/b0f43a65/attachment-0001.html>
More information about the es-discuss
mailing list