On Fri, May 31, 2013 at 5:01 PM, Rick Waldron <[email protected]>wrote:

> `undefined` is a valid initial value for Array.prototype.reduce.
> `undefined` will also trigger the default parameter, so this works until
> nothing is provided, which breaks Step 10.
>

I guess that's what my question boils down to: is `undefined` a valid
initial value? It probably has to be for backwards-compatibility reasons.


>
>
>>
>> If, however, the value `undefined` means that the argument is present,
>> the signature should probably be:
>>
>> `function ArrayReduce(callbackfn, ...rest)`
>>
>
> With minor changes to steps 9 and 10, plus the addition of steps to check
> rest.length and then Get(rest, "0"), this would work. I suspect that Allen
> would prefer to craft some sort of spec mechanism, from this use case, for
> "is foo present" assertions throughout the spec.
>

That's what I'm using for the moment, and will probably continue using,
given the abovementioned conclusion regarding backwards-compatibility, yes.


thanks,
till
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to