Scoped binding of a method to an object

Brendan Eich brendan at
Mon Oct 14 15:58:18 PDT 2013

Russell Leggett wrote:
> It doesn't use dots, so it won't mask the difference between the 
> normal prototype chain with some additional scoped binding (for good 
> or ill), but along with it comes the clarity and comfort of lexical 
> binding and also the potential use of the module system.
>     import {shuffle,each,filter} from "underscore2";
>     myArray::shuffle();

This is really winning, thanks again.

We already have good motivation for :: anyway, as sugar for bind. This 
gives relief to the OO side of the expression problem trade-off by 
allowing lexical bindings to be composed with method calls -- beautiful. 
No third scope axis / lookup parameter!

> And if that isn't enough because you need more polymorphic behavior, I 
> think something like Clojure's protocols 
> <> could be implemented as a library to be 
> used in conjunction.

How about a spin-off thread?


More information about the es-discuss mailing list