Open bergus opened 8 years ago
Hmm, it seems to me that the expression "resolved but stilled pending" is an oxymoron. You are getting caught up in the poor naming of Promise.resolve
and the resolve
parameter to the executor, which actually mean "resolve or assimilate". I guess it would be better to say "where the promise has assimilated a promise which is still pending".
Terminology aside, it seems to me that you are violating the semantics of assimilation, which is referred to as "adopt its state" in the Promises/A+ spec. Do you not now have the confusing situation where a promise may be canceled EITHER by the assimilated promise canceling OR the original promise canceling?
@rtm "resolved" is the correct and official terminology.
I don't think I'm violating any semantics. If a promise has an associated token, the cancellation races against the settling (fulfillment/rejection) via the resolving functions (including adoption). And no, a promise cannot be cancelled via the assimilated promise, only by its own token and nothing else.
This proposal allows promises to be cancelled through their associated token at any time until it is settled. That means that when they are already resolved but still pending (i.e. resolved with a pending promise), then they might still get cancelled:
logs "It's over" after one second.
This is a major difference to Domenics proposal which requires the inner promise to be cancelled for cancellation of the outer, so I would like this discussed.