Mutable Proto

Andrea Giammarchi andrea.giammarchi at gmail.com
Wed Mar 20 11:04:26 PDT 2013


I don't understand where is the problem ... any library that uses __proto__
can and should be updated with a shim waiting for next version of JS to
support it.

Object.setPrototypeOf = function (object, proto) {
  object.__proto__ = proto;
  return object;
};

That does not look bad at all to me, educate developers out there that
__proto__ is harmful and forbidden 'cause saying "we can't do much is
already used" doesn't mean is OK to use it, same as polluting
Object.prototype, still possible, nobody does it (not in an old fashioned
way at least)

Best Regards




On Wed, Mar 20, 2013 at 9:27 AM, David Bruant <bruant.d at gmail.com> wrote:

> Le 20/03/2013 16:15, Brendan Eich a écrit :
>
>> To recap,
>>
>> 1. __proto__ is out in the field, a de-facto standard on "mobile", and
>> not going away. Adding another API doesn't help, it hurts.
>>
>> 2. SES and other secure subsets want same-frame (global object, "realm")
>> mashups of code that may use __proto__ and code that must not, but
>> Object.setPrototypeOf is a per-frame capability that would have to be
>> removed, breaking the former class of code.
>>
>> (...)
>>
>>
>> Yes, the problems you cite are real, but they are already part of the
>> de-facto __proto__ standard (1).
>>
> Agreed.
> From the spec/implementor point of view, __proto__ has to be added as
> de-facto standard because it is used.
> From the developer point of view, it is not because it's in the language
> that it's a good idea to use it. Quite the opposite, I'd like to reiterate
> that devs should make "delete Object.prototype.__proto__" the second line
> of their code (first line is "use strict";).
> Devs shouldn't make the mistake to think that __proto__ in the standard
> makes it a good or legitimate feature.
>
> __proto__ in ES6 is yet another ECMAScript Regret [1]
>
> David
>
> [1] https://github.com/**DavidBruant/ECMAScript-regrets<https://github.com/DavidBruant/ECMAScript-regrets>(I haven't found much time to write more, but issues are more interesting
> to read than just the part that's been written down)
>
> ______________________________**_________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130320/fc0104e0/attachment.html>


More information about the es-discuss mailing list