tc39/proposal-promise-allSettled

Clarify the need for `Function#length` notes

Closed this issue · 4 comments

https://github.com/jasonwilliams/proposal-promise-allSettled/blob/b56ce24c0c970627cc2e2853046dd3fa7bf5c3af/spec.html#L102

      <p>**WHY DO WE NEED TO STATE THIS?** The `"length"` property of a `Promise.allSettled` resolve element function is 1.</p>

https://github.com/jasonwilliams/proposal-promise-allSettled/blob/b56ce24c0c970627cc2e2853046dd3fa7bf5c3af/spec.html#L128

      <p>**WHY DO WE NEED TO STATE THIS?** The `"length"` property of a `Promise.allSettled` resolve element function is 1.</p>

@jasonwilliams @rpamely I think the intention is to do this for all functions in the spec, but you’re right that this does not seem to be done consistently right now. E.g. Array.from lacks such such a statement.

The intention is to include the note only when the function's length doesn't match the number of non-optional arguments. In the case of "Resolve Element Functions", both are needed, because they don't have a normal-style signature.

@ljharb What does a normal style signature look like in the spec?

@jasonwilliams like FunctionName (arg1, arg2[, optionalArg3[, optionalArg4]]), for example - all non-optional arguments count towards the length.