Why we need to clean up __proto__

Mark S. Miller erights at google.com
Wed Dec 28 17:48:05 PST 2011

On Wed, Dec 28, 2011 at 1:09 AM, Axel Rauschmayer <axel at rauschma.de> wrote:

> The cleanest solution to the problem you outlined seems to be to never use
> objects as dictionaries(?) That is, one would separate the concerns program
> definition and application data. Allen’s object model reformation (allowing
> one to override the [] operator) would help, too.
> http://wiki.ecmascript.org/doku.php?id=strawman:object_model_reformation

Hi Axel,

I agree that we should encourage programmers to stop using object directly
as maps from strings to values because of these hazards. In fact, Caja and
SES are moving all such uses over to using the StringMap abstraction at <
My point was not that programmers *should* use objects-as-stringmaps, but
rather that the hazards created by the diversity of unspecified magical
__proto__ behaviors is a hazard that has tripped up many, including expert
JS programmers. If we pin down its normative-optional semantics, then when
present, it will at least behave in a consistently bizarre manner. As FF,
Dave, and Lasse suggest, the least magical way for this to act is as an
accessor inherited only from Object.prototype.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111228/7c2b4ded/attachment.html>

More information about the es-discuss mailing list