From: Brendan Eich
Sent: 21 March 2011
On Mar 21, 2011, at 1:13 PM, Erik Arvidsson wrote:
>
> The above use case cannot be solved using private names because
> private names conflict with public names.
I don't see this, though. Don't oversell!
I think it's true: you can't do this with private name.
private filter;
Object.filter = function defaultFilter() { ... };
[0, 1, 2].filter(...) // will triggers Object.filter and not Array.filter,
because filter is not "filter" anymore but a private name instead.
If you use a "normal name" with a reduced visibility instead, the classical
prototype chain will continue to works as expected.
Regards,
François
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss