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
and
q.m === q.m
but what about
o.m === p.m
and
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
either.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss