You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code of ThenableToPromise and Promise Reaction Functions both does a form of thenable coercion:
The former tries to coerce thenables straight-up into promises, so that its caller can use a trusted promise then or just pass the value on through.
The latter tries to send a "then" message to the return value of [[Handler]] using deferred.[[Resolve]] and deferred.[[Reject]] as the parameters, or just call deferred.[[Resolve]] if it's not a thenable.
These are pretty similar, but I believe I'm making them unnecessarily distinct in my current set up. E.g., if I moved some of the caller behavior into the former, the parallel would be clearer.
Once these functions are deduplicated, I will probably have an easier time reintroducing the thenable coercions weak map. I gave it a stab in bring-back-thenable-coercions branch but it did not pass the existing tests because I only did it inside ThenableToPromise and not inside Promise Reaction Functions.
I am reasonably happy with the verbiage surrounding the weak map in that branch, so the work here subsumes #39. Also I can try to be sure not to reintroduce any reentrance bugs, so let's subsume #61 in here too.
The text was updated successfully, but these errors were encountered:
This reverts commit bbc5b5c. As per #79, the thenable coercions weak map is, at least in its current form, not a good idea.
This also fixes#82, since the realm is no longer needed.
The code of ThenableToPromise and Promise Reaction Functions both does a form of thenable coercion:
then
or just pass the value on through.These are pretty similar, but I believe I'm making them unnecessarily distinct in my current set up. E.g., if I moved some of the caller behavior into the former, the parallel would be clearer.
Once these functions are deduplicated, I will probably have an easier time reintroducing the thenable coercions weak map. I gave it a stab in bring-back-thenable-coercions branch but it did not pass the existing tests because I only did it inside ThenableToPromise and not inside Promise Reaction Functions.
I am reasonably happy with the verbiage surrounding the weak map in that branch, so the work here subsumes #39. Also I can try to be sure not to reintroduce any reentrance bugs, so let's subsume #61 in here too.
The text was updated successfully, but these errors were encountered: