Private Slots

Brendan Eich brendan at mozilla.com
Wed Jan 16 12:48:27 PST 2013


Mark S. Miller wrote:
> My position on private symbols.
>
> My position on classes is and has always been that classes are worth
> introducing into the language*only*  if they give us, or can be used
> with, an affordable means for true object encapsulation. Assuming
> Allen is right about what actual implementors will do (which I find
> plausible) then WeakMaps are not that means. Given other discussions,
> I am confident that the objects-as-closures pattern will not become
> efficient either -- it is likely to continue to cost an allocation per
> method per instance as its semantics naively suggests. So of the
> options practically on the table, I think private symbols are the only
> workable choice. If this is correct, then I consider private symbols
> to be a requirement. Am I missing anything?

I agree, but David Bruant is arguing for weakmap-with-hint still, and 
Kevin is arguing (my summary) "YAGNI" to high-integrity privacy, not 
exclusively but for most developers -- and for the SES minority, 
weakmaps are enough.

/be


More information about the es-discuss mailing list