Adam - Please read my question again:* What happens if you replace foo.__proto__ with Object.getPrototypeOf(foo)? *
On Tuesday, September 24, 2013 1:11:19 PM UTC-4, Adam Crabtree wrote: > > The situations I'm talking about were both cases where I needed to set the > __proto__ of a function to inherit from another object or function. One is > an instance where Function.create is insufficient because I did not create > the originating function. > > > On Sat, Sep 21, 2013 at 12:31 PM, Andrew Kelley > <[email protected]<javascript:> > > wrote: > >> Adam - >> >> I am interested in the code where using __proto__ was the only solution. >> This would be a counter-example to my initial claim #2. What happens if you >> replace foo.__proto__ with Object.getPrototypeOf(foo)? >> >> >> >> >> On Fri, Sep 20, 2013 at 4:03 PM, Adam Crabtree >> <[email protected]<javascript:> >> > wrote: >> >>> Removing __proto__ is both naive and misinformed for several reasons. >>> >>> Further, there is nothing in Domenic's dict project that suggests the >>> presence of __proto__ is itself a problem. At best, it implies its use will >>> somehow "ruin your day" with a link to a google docs bug[1] that merely >>> illustrates the need for Object.create(null), which has *nothing* to do >>> with Google Docs *using* __proto__. It also doesn't address any of the >>> functionality __proto__ provides, which is of course expected b/c that's >>> not the point of the dict module. >>> >>> To be fair to Domenic, we're almost certainly recontextualizing his >>> points, so they especially don't apply here at all. >>> >>> At any rate, here's a list of reasons removing __proto__ is a bad idea: >>> >>> 1. Node.js === V8, and since V8 has __proto__ there's plenty of code >>> (both libraries and application code) that use __proto__. Do you have a >>> good reason why having it will cause more damage than breaking all existing >>> code that does? >>> >>> 2. I really hope it's not removed from strict mode until the language >>> provides equivalent functionality. Think Object.create is sufficient? What >>> about Function.create, Error.create or even Array.create? I've had handful >>> of cases both in library code and application code where the best solution >>> was to use __proto__ and several times where it was the only solution[2,3]. >>> >>> 3. Even if Function.create and Error.create existed, what about >>> reassigning after creation in cases where your application code did not >>> create it? >>> >>> Let's not fork to create a handcuffed version of the language. >>> >>> Cheers, >>> Adam Crabtree >>> >>> >>> >>> [1] >>> http://productforums.google.com/forum/#!msg/docs/0hQWeOvCcHU/13arVnFhU4YJ >>> [2] https://github.com/CrabDude/trycatch/issues/23 >>> [3] https://github.com/CrabDude/proxis/blob/master/proxis.js#L121 >>> >>> >>> On Fri, Sep 20, 2013 at 11:35 AM, Jorge Chamorro < >>> [email protected] <javascript:>> wrote: >>> >>>> On 20/09/2013, at 15:40, mks wrote: >>>> >>>> > {} is not an hash table. Object.create(null) is more likely >>>> >>>> That, *and* kill the __proto__, if not: >>>> >>>> hash= Object.create(null); >>>> key= '__proto__'; >>>> >>>> hash[key]= 27; >>>> hash[key] >>>> null //What? >>>> >>>> Or worse: >>>> >>>> hash[key]= this; >>>> 'require' in hash >>>> true //What? >>>> 'console' in hash >>>> true //What? >>>> 'Array' in hash >>>> true //What? >>>> >>>> etc. >>>> -- >>>> ( Jorge )(); >>>> >>>> -- >>>> -- >>>> Job Board: http://jobs.nodejs.org/ >>>> Posting guidelines: >>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>>> You received this message because you are subscribed to the Google >>>> Groups "nodejs" group. >>>> To post to this group, send email to [email protected]<javascript:> >>>> To unsubscribe from this group, send email to >>>> [email protected] <javascript:> >>>> For more options, visit this group at >>>> http://groups.google.com/group/nodejs?hl=en?hl=en >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "nodejs" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected] <javascript:>. >>>> >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> >>> >>> >>> -- >>> Better a little with righteousness >>> than much gain with injustice. >>> Proverbs 16:8 >>> >>> -- >>> -- >>> Job Board: http://jobs.nodejs.org/ >>> Posting guidelines: >>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To post to this group, send email to [email protected]<javascript:> >>> To unsubscribe from this group, send email to >>> [email protected] <javascript:> >>> For more options, visit this group at >>> http://groups.google.com/group/nodejs?hl=en?hl=en >>> >>> --- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "nodejs" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/nodejs/HvwsNAuAN2Q/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected] <javascript:>. >>> >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to [email protected]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "nodejs" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > Better a little with righteousness > than much gain with injustice. > Proverbs 16:8 > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
