setPrototypeOf vs obj.__proto__ assignment

Andrea Giammarchi andrea.giammarchi at gmail.com
Mon Apr 7 11:44:47 PDT 2014


that's why it's the preferred choice ... otherwise we keep promoting and
trapping developers behind a broken pattern.

If we keep saying "just use `__proto__`" code won't ever migrate but it's
been discussed that in some case `__proto__` is a very problematic keyword.

[nashorn](http://openjdk.java.net/projects/nashorn/) even implemented it
with the infamous dual intent, `obj["__proto__"]` vs `obj.__proto__` ,
thanks gosh [duktape](http://duktape.org/)  didn't implement `__proto__` at
all and it promotes pure ES5.1 approach via `Object.create` and no hot-swap
problems.

Cheers



On Mon, Apr 7, 2014 at 11:02 AM, John Barton <johnjbarton at google.com> wrote:

>
>
>
> On Mon, Apr 7, 2014 at 10:51 AM, Andrea Giammarchi <
> andrea.giammarchi at gmail.com> wrote:
>
>> ..
>>
>> It feels like everyone uses `__proto__` on daily basis while ES6 promotes
>> classes ... so either `__proto__` is not a real world use case, or `class`
>> landed for no reason, IMO.
>>
>
> You are correct, lots of code uses '__proto__', but your conclusions based
> on this make no sense.  ES6 has nothing to say about daily use until it
> ships in all relevant platforms, and the current count is zero.
> Moreover, on platforms without setPrototypeOf(), it's advantages are not
> relevant.
> jjb
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140407/ee7701e8/attachment-0001.html>


More information about the es-discuss mailing list