Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Large rewrite of internals to satisfy subclassing constraints.
This rewrite was the result of many discussions, starting in #54, but continuing into countless IM and email conversations. There were several competing concerns that arose, and I think this satisfies them all. This rewrite is inspired largely by @rossberg-chromium's https://github.com/rossberg-chromium/js-promise/blob/master/promise.js, although there were many modifications necessary to make it work and pass all the tests. In the end, the guiding principles seem to be: - Store resolution value and rejection reason, instead of trying to extract a fulfillment value from the resolution value. - Centralize all unwrapping in `then`, both on the input side (done by Promise Resolution Handler Functions) and the output side (done by Promise Reaction Functions). - Do not differentiate between promises, promise subclasses, and thenables; use the `then` interface to send messages to all of them. - More generally, do not use abstract operations when methods will do. Abstract operations should only supply the default implementation of methods. As part of this rewrite, several other issues were addressed; #36 was started on, and most editorial and formatting issues (#34, #37, #49) were taken care of. This also closes #60 by virtue of that function no longer existing. Note that the thenable coercions weak map was temporarily removed; it will be added back later (#39 #61).
- Loading branch information
002ec7a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
002ec7a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rossberg-chromium Would you mind opening separate issues for those so we can discuss them separately? I guess the first two can be lumped together.
002ec7a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.