Mutable Proto

Andrea Giammarchi andrea.giammarchi at gmail.com
Wed Mar 20 12:40:01 PDT 2013


I think zepto is using that to modify runtime NodeList results after
querySelectorAll but in any case it was not me saying that __proto__ is
used already. I use it only to shim getPrototypeOf to be honest and I don't
think is a good idea to use it at all.

My point is that Object.setPrototypeOf does not need a property loads of
shenanigans as __proto__ is so that no Object.prototype.__proto__ would
ever exist anywhere.

I don't even know why that existed in first place,to be honest ... so do
not use it, pass through Object.setPrototypeOf, same as you would suggest
pass through Object.defineProperty instead of using
Object.prototype.__defineGetter__ __defineSetters__, both "de facto
standards" some time ago.

So, reverting the question, what is **your** point saying that __proto__ is
better than Object.setPrototypeOf ?

Regards


On Wed, Mar 20, 2013 at 12:22 PM, David Bruant <bruant.d at gmail.com> wrote:

>  Le 20/03/2013 19:04, Andrea Giammarchi a écrit :
>
> 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.
>
> Which library? What are the inconsistencies between the current __proto__
> draft spec and how libraries use __proto__ today? Please be very specific;
> that's quite relevant when doing a de facto standard so it's important to
> know.
>
>
>  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)
>
> What's your point here?
> I don't understand why Object.setPrototypeOf should be added or shimmed if
> the best practice is to avoid using __proto__.
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130320/b87f9c9a/attachment-0001.html>


More information about the es-discuss mailing list