>>> 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; also "generic" 
> suggests "generics", i.e. type parameters).

Understood, but generic functions (the way that Common Lisp and Dylan use that 
term) are a logical extension of JavaScript’s generic functions (the way ES-262 
uses that term). Right now, JS generic functions have implicit contracts that 
one could make explicit (e.g. via some kind of duck typing). Type guards also 
seem loosely related.

> 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.

Right. That’s where my dreams come in. ;-)

-- 
Dr. Axel Rauschmayer

[email protected]
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com



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

Reply via email to