Scoped binding of a method to an object

Brendan Eich brendan at
Tue Oct 15 10:26:43 PDT 2013

> Benjamin (Inglor) Gruenbaum <mailto:inglor at>
> October 15, 2013 12:45 AM
> Brendan Eich <brendan at <mailto:brendan at>> wrote:
> > 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!
> Yeah, but this doesn't solve the original problem nearly as well IMO 
> since it's suddenly different from a normal method call. Having a 
> different call operator for scoped extension methods or method 
> invocation seems very confusing and counter intuitive for developers.

That's one-sided, though. The other side you are discounting is the 
confusion when code in the scope of the extension wants to call 
cowbow.draw not graphics.draw, but draw has been overridden on the right 
of dot.

Any solution must allow programmers to say what they mean. Since new 
syntax is required even in the dot-based proposal (at the end, to 
declare the extension), the cost of an alternative to dot is not novel 
in the sense of breaking operation on downrev browsers. In other words, 
a compiler to older JS will be required in any event.

> If I have to remember different invocation mechanics I kind of lost 
> already and I don't have the polymorphism I wanted. I completely agree 
> with Allen here.

Which polymorphism to people want? There is a "DWIM" aspect that cannot 
possibly cover all uses of, e.g., 'draw' on the right of dot.


More information about the es-discuss mailing list