-
Notifications
You must be signed in to change notification settings - Fork 161
Description
Hopefully these can be made more precise (I'll be happy to attempt a PR if desired):
but does not imply deep immutability.Probably clear enough to most, but a quick example would make it even more clear to people with less experience.
2. If `onFulfilled` is a function:
i. it must be called after promise is fulfilled, with promise's value as its first argument.Does it actually mean "as its only argument"? The same for 3.i.
5. `onFulfilled` and `onRejected` must be called as functions (i.e. with no `this` value). [3.2]Would saying "with this value being undefined" make it more precise?
6. `then` may be called multiple times on the same promise.Very confusing. Any example of how this can happen?
6.1. If/when `promise` is fulfilled, all respective `onFulfilled` callbacks must execute in the order of their originating calls to `then`Isn't there always a single onFulfilled callback inside then? What is the meaning of the "all respective callbacks"?
What is the precise meaning of "their originating call to then? Any example?
7.i. If either `onFulfilled` or `onRejected` returns a value `x`, run the Promise Resolution Procedure [[Resolve]](promise2, x).Maybe it would be more clear to say "... don't throw an exception", as undefined is also a value and both are functions, so they always return a value unless throw.
7.iii. If `onFulfilled` is not a function...However, it looks like in 7.i and 7.ii it was assumed this was a function. Maybe make it more precise by adding "If ... is a function" to those?
... assumption that x behaves at least somewhat like a promiseObviously "somewhat like promise" is imprecise. Any way to make it more clear?
1. If `promise` and `x` refer to the same object, reject `promise` with a `TypeError` as the reason.Any example how that is possible in this situation?
And why is that a TypeError if the reason is the objects identity, not the wrong type?
2. If x is a promise, adopt its state [3.4]:This feels like a circular logic, since it is inside the spec defining what promise is. Can this definition made avoid referring to promise?