Private Slots

Sam Tobin-Hochstadt samth at ccs.neu.edu
Mon Jan 14 08:04:22 PST 2013


On Mon, Jan 14, 2013 at 10:57 AM, Kevin Smith <khs4473 at gmail.com> wrote:
> When a property is added to an object using a private symbol, it creates a
> new kind of slot:  a private slot.  It is clear from the design of the Proxy
> API that this represents a fundamentally new extension to the ES object
> model.

I (as one of the people who has advocated for symbols) disagree
entirely.  The JS object model extension required for symbols is small
-- JS objects now map from either strings or symbols to values (plus
prototype inheritance, getters, setters, configurability,
writeability, and the other aspects of the JS object model the quote
below glosses over).

The reason that the Proxy API is complex from the perspective of
private symbols is that combining reflection with encapsulation and
object-capability based security principles is a tricky and
less-well-explored domain.  Fortunately, Tom as well as others have
done an excellent job with this design, and I'm confident in it.
However, that complexity is *not* the same as complexity in the
fundamental object model.

> On the very first paragraph of the CoffeeScript homepage, we read:
>
>> Underneath all those awkward braces and semicolons,
>> JavaScript has always had a gorgeous object model at
>> its heart.

Sam


More information about the es-discuss mailing list