Adding methods to {Array,String}.prototype

Brendan Eich brendan at mozilla.com
Fri Jul 29 10:18:15 PDT 2011


On Jul 29, 2011, at 10:08 AM, Brendan Eich wrote:

> On Jul 29, 2011, at 9:53 AM, Axel Rauschmayer wrote:
> 
>>> I like Underscore (http://documentcloud.github.com/underscore/). Should we standardize it? Not yet. But it points in the right direction to avoid OOP single-inheritance traps: functional programming, generic for all containers functions.
>> 
>> I love true generic functions (as in “multiple dispatch”) and think that they would be a good match for JS (not any time soon, but one can dream). I see generic functions as complementary to single dispatch (including prototypes). Reenskaug and Coplien [1] seem to agree. Generic functions are also great for working with data coming from web services (e.g. JSON).
> 
> I did not mean multimethods ("generic functions" is a confusing term, since it also means functions that work for parameters of any time

s/time/type

Coffee time!

/be

> ; also "generic" suggests "generics", i.e. type parameters).
> 
> ES4 had a proposal for multimethods but I doubt it will make a come-back. Adding another dispatch mechanism to JS is a very hard sell. For dyadic operators, double dispatch is enough.
> 
> /be
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list