Reduce context parameter

Brendan Eich brendan at mozilla.com
Mon Jan 7 15:02:49 PST 2013


The impediment that I recall during ES3.1 days was the accumulator 
parameter to reduce/reduceRight, which wants to come immediately after 
the callback function. Both are mandatory, whereas |thisValue| 
("context", shudder) is optional. So accumulator won.

As for .bind's cost, let's remember Knuth: 
http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize.

/be

Andrea Giammarchi wrote:
> Rick you know bind is that slow and it costs on GC if used massively ;-)
>
> I use a lot the second argument in Array#extras and I feel Peter van 
> der Zee here: reduce/Right should have had that too
>
> br
>
>
> On Mon, Jan 7, 2013 at 1:10 PM, Rick Waldron <waldron.rick at gmail.com 
> <mailto:waldron.rick at gmail.com>> wrote:
>
>     I know this doesn't answer your question, but
>     Function.prototype.bind makes thisArg obsolete.
>
>     Regarding the origin story, there is some discussion here:
>     https://mail.mozilla.org/pipermail/es-discuss/2008-June/006431.html
>
>     Rick
>
>
>     On Mon, Jan 7, 2013 at 3:56 PM, Andrea Giammarchi
>     <andrea.giammarchi at gmail.com <mailto:andrea.giammarchi at gmail.com>>
>     wrote:
>
>         I think to increase confusion with other Array#extras :D
>
>         and since we have this specced as it is now, a third parameter
>         for the context could add even more confusion later on <3
>
>         I know, I should not have answered that ...
>
>
>         On Sun, Jan 6, 2013 at 9:48 AM, Peter van der Zee
>         <ecma at qfox.nl <mailto:ecma at qfox.nl>> wrote:
>
>             Mostly out of curiosity; why do Array#reduce and
>             reduceRight have no
>             context parameter?
>
>             - peter
>             _______________________________________________
>             es-discuss mailing list
>             es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>             https://mail.mozilla.org/listinfo/es-discuss
>
>
>
>         _______________________________________________
>         es-discuss mailing list
>         es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>         https://mail.mozilla.org/listinfo/es-discuss
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list