>     { [stringSym]: value }
>     // or
>     obj[stringSym] = value
>
> leaks to Object.keys and for-in, which are very commonly used operations
> and will get used in conjunction with getting and setting. That destroys
> the encapsulation component of Symbols, which I argue is one of (if not the
> primary) benefit of Symbols.
>

Are you arguing that non-enumerability is a useful encapsulation mechanism?
 I'm skeptical.  The main use case that I've seen for for-in and
Object.keys is using a plain object as a map.  This use case is addressed
more cleanly now with Map and for-of, is it not?

Furthermore, developers today generally use underscores to "hide" internal
properties and methods.  I'm not aware that it is a common practice to
bother with making these properties non-enumerable.  Is it?

{ Kevin }
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to