Ducks, Rabbits, and Privacy

Dean Landolt dean at deanlandolt.com
Tue Jan 22 13:49:45 PST 2013


On Tue, Jan 22, 2013 at 4:03 PM, Kevin Smith <khs4473 at gmail.com> wrote:

>
>
>> +1 to this and everything else Nathan has said. Watching all this intense
>> back and forth, there are a lot of good points, some of which almost
>> convince me that weak maps are sufficient and private symbols are
>> unnecessary. But when I step back for even a minute, as a developer private
>> symbols are exactly what I want, and weak maps are an un-ergonomic hack.
>>
>
> Are you sure they are what you want?  When you attempt to create private
> methods using private symbols, you will break the inheritance mixin
> pattern.  Is that what we want?
>

The idea of a WeakMap desugaring appeals to me, though I don't understand
how this desugaring solves the mixin inheritance problem? I'm probably
missing something -- I can't tell how prototypal inheritance is intended to
work, if at all, with private properties. Would it disappear? If so, this
would break a core tenet of the object model, which seems more detrimental
than breaking a very specific pattern (a diamond-shaped antipattern?) in
one specific case. Naive mixins are naive -- this seems like an acceptable
trade-off, especially when there are patterns with more integrity available.


> A weakmap-based solution can be made as ergonomic as you like.  Without
> syntax, it can be a simple function call (like Juan Dopazo's), and with
> syntax...
>

If a desugaring could be made to support prototypal inheritance this would
be ideal. But assuming private symbols cannot be intercepted by proxies
would there be an observable difference between private symbols and this
kind of weakmap desugaring (including some kind of gc hint, per the gist)?
If none, and Allen finds private symbols helpful for specification
purposes, is it worth bothering with a desugaring at all (including
whatever it entails, like WeakMap gc hints and any other baggage)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130122/90eab589/attachment.html>


More information about the es-discuss mailing list