Syntactic sugar for using a function as if it were a method of its first argument

Brendan Eich brendan at
Tue May 27 12:29:06 PDT 2014

Jasper St. Pierre wrote:
> I'm not sure I like it. Given how other languages use the "::" 
> operator, I'd expect "Foo::bar" to do some sort of static property 
> lookup for a name called "bar" on "Foo", not bind the local variable 
> "Foo" to the local variable "bar". 

That's not what the proposed bind operator does.

> I think "bar.bind(Foo)" is more than enough.

That allocates a new (and subtly different) bound function object. Part 
of the motivation for the bind operator is to avoid the allocation (and 
the subtle difference, secondarily).


More information about the es-discuss mailing list