Reduce context parameter

Brandon Benvie brandon at brandonbenvie.com
Mon Jan 7 17:11:52 PST 2013


This is why I ended up using $$ArgumentCount and $$HasArgument('name')
primitive magics. The ES spec's usage of "argument exists" doesn't really
line up with the semantics of default params. The semantics of default
params are better but it's too late to go back and make explicit
undefined's the same as a lack of a parameter for this stuff (I'm sure
someone out there uses array.reduce(cb, undefined) and depends on it).


On Mon, Jan 7, 2013 at 7:34 PM, Rick Waldron <waldron.rick at gmail.com> wrote:

>
>
> On Monday, January 7, 2013, Andrea Giammarchi wrote:
>
>> but this is wrong
>> array.reduce(cb, array[0], ctx);
>>
>> since index 0 will be looped so first call previous and current will be
>> the same ... right ? That's why I've used undefined but I understand your
>> concern so, as it is right now, there's no way to implement the context in
>> both reduce and reduceRight ... Peter van der Zee use bind :D
>>
>
> Yeah, you'd need to mess it up further array.slice(1).reduce... Even less
> worth it now
>
> Rick
>
>
>
>
>>
>>
>>
>> On Mon, Jan 7, 2013 at 3:41 PM, Rick Waldron <waldron.rick at gmail.com>wrote:
>>
>>> array.reduce(cb, array[0], ctx);
>>
>>
>>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130107/abe21af1/attachment-0001.html>


More information about the es-discuss mailing list