Clarify the need for `Function#length` notes
Closed this issue · 4 comments
mathiasbynens commented
<p>**WHY DO WE NEED TO STATE THIS?** The `"length"` property of a `Promise.allSettled` resolve element function is 1.</p>
<p>**WHY DO WE NEED TO STATE THIS?** The `"length"` property of a `Promise.allSettled` resolve element function is 1.</p>
mathiasbynens commented
@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.
ljharb commented
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.
jasonwilliams commented
@ljharb What does a normal style signature look like in the spec?
ljharb commented
@jasonwilliams like FunctionName (arg1, arg2[, optionalArg3[, optionalArg4]])
, for example - all non-optional arguments count towards the length.