Bound instance-function vending (was RE: Arrow binding)

Brendan Eich brendan at
Mon Apr 23 15:01:13 PDT 2012

Brendan Eich wrote:
> No, in any such prototype-getter-makes-bound-function scenario, we 
> would need memoization, so that
>   o.m === o.m
> (Edit: I see you mention this below.) 

The real problem is better captured by showing the prototype p and two 
instances, o and q:

    p.m === p.m

should be true. So should

   o.m === o.m


   q.m === q.m

but what about

   o.m === p.m


   o.m === q.m

JS requires distinct bound function identity from the unbound p.m 
identity, so false and false.

If we managed to extend JS with a classy declarative syntax that enabled 
vtables, while keeping functions first class (at the price of 
prototype-chain mutation: assignment to override, or shadow; also of 
course delete), then we might well want true and true. But there would 
be no way in JS itself to implement such magic in terms of properties 
(data or accessor, doesn't matter) with function values.

This is why I continue to think that we won't see what Alex predicted: 
prototype getter method vending. We haven't see it much in the wild yet 


More information about the es-discuss mailing list