Are Private name and Weak Map the same feature? and the Assoc API

David Bruant bruant.d at gmail.com
Thu Dec 22 16:59:43 PST 2011


Le 22/12/2011 10:47, Andreas Rossberg a écrit :
> I strongly believe that any ad-hoc behavioural distinction that we
> need to introduce between plain and private property names indicates a
> problem with the semantics of either private names or proxies (or JS
> objects in general, which is the scariest case). We should try very
> hard to avoid them.
I think that you are the one who pointed the actual problem [1] when
explaining that is the root issue in Sam's use case is the lack of
lexical 'this' (and neither private names nor proxies)
Assuming this is an issue that cannot be fixed in ES6, we have to accept
it and work around it. I think we are in such a case where we need to
find a workaround. I agree we should try to avoid this kind of decision,
but not being able to fix lexical 'this' does not seem to let other
options than dividing private names in a way or another.
Current proposal suggests public/private and implicit conversion when
passing to traps. I proposed 2 kinds of private names. Tom did too (with
a slightly different semantics).

I agree with you and wished we didn't have to do this, but it seems
necessary, assuming the strong backward compatibility constraint we have.

David

[1] https://mail.mozilla.org/pipermail/es-discuss/2011-December/018971.html


More information about the es-discuss mailing list