Adding methods to {Array,String}.prototype

Brendan Eich brendan at mozilla.com
Thu Jul 28 12:35:34 PDT 2011


On Jul 28, 2011, at 2:19 AM, Axel Rauschmayer wrote:

> In general, I’m strongly in favor of adding more methods to these prototypes. I have always been impressed by how many useful data manipulation features were in the standard libraries of functional languages (e.g. Haskell) and in scripting languages such as Python. JavaScript should have more of these, perhaps by examining what functionality frameworks are providing in this area.
> 
> Do we have to wait for a collections hierarchy for more of these methods to be added? Couldn’t the relevant methods be easily moved to a superclass once that happens?

There is no superclass. Trying to make one is a bad idea. We'll end up with the usual tyranny-of-hierarchy problem where you want something to multiple inherit to be both a Collection and a Widget.

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.

/be


More information about the es-discuss mailing list