Why not private symbols?

Domenic Denicola domenic at domenicdenicola.com
Fri Aug 2 13:02:54 PDT 2013

From: Erik Arvidsson [erik.arvidsson at gmail.com]

> We went through the exercise of only having private symbols but it lead to some issues. Here is one that we identified.

> Lets assume we use a private symbol for the @@iterator. The symbol can still be checked because anyone that has access to the right module can get it. It is also important that a proxy for an object, O, is not invoked when you do O[privateSymbol]. This means that it is not possible to create an iterable proxy object, since no trap on the proxy is invoked.

I know the answer will be obvious when I see it, but I can't quite remember ... why is it important that `O[privateSymbol]` not invoke the proxy?

More information about the es-discuss mailing list