Standardizing __proto__

Brendan Eich brendan at mozilla.com
Fri Mar 18 17:27:18 PDT 2011


On Mar 18, 2011, at 1:46 PM, Dmitry A. Soshnikov wrote:

> Other examples: https://github.com/DmitrySoshnikov/es-laboratory/blob/master/examples/create.js

Thanks, this is helpful.


> So the mutable __proto__ (no matter in which name and view) can be standardized only if (1) no security issues, (2.1) practically needed or (2.2) just "a cool stuff of dynamic languages" with unfortunately small practical application.

(1) is more about quality of implementation, extensions vs. fuzz-re-testing, and general cost of mutable __proto__. The verdict in my experience is negative.

(2.1) is false on its face: we can provide narrower special forms to cover the "define" (set on a newborn or otherwise-inaccessible object) use-case.

(2.2) is not just false, but permanently so: "no" on its face. You can't justify an intrusive feature with buzzword momentum.


> To avoid i-looping, Object.setPrototype(object, parent); is better than __proto__ of course.

Assignable __proto__ requires cycle checking with an exception thrown on detected cycle, of course. Implementations already do this check, and I do not see how Object.setProottypeOf avoids the need for it.

In terms of standardization, Object.setPrototypeOf is a non-starter.

/be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110318/e4ce3edb/attachment-0001.html>


More information about the es-discuss mailing list