On Tue, Sep 24, 2013 at 6:21 PM, Tim Smart <[email protected]> wrote:
> Please don't, `__proto__` is great if not abused. Swapping out the
> prototype of
> an object is extremely useful.
>
Top posting sucks.
Rick
>
> function MyEventEmitter () {
> EventEmitter.call(this)
> }
> MyEventEmitter.prototype.__proto__ = EventEmitter.prototype
>
> Extremely easy inheritance and you don't have to mess with the constructor
> property etc. Also allows you to do cool things with the default
> constructors
> without messing with their prototypes.
>
> var superArrayProto = { forEach : myCustomForEachFunction }
> superArrayProto.__proto__ = Array.prototype
>
> function makeSuperArray (arr) {
> arr.__proto__ = superArrayProto
> return arr
> }
>
> var superArray = makeSuperArray([])
> (myCustomForEachFunction === superArray.forEach) // true
>
> On Thu, Sep 19, 2013 at 12:35:59PM -0700, Andrew Kelley wrote:
> > I'm sure this has been discussed before but I don't know where.
> >
> > Here are some facts:
> >
> > 1. Putting user data (and other kinds of data if you're not careful)
> inside
> > an object is a huge security problem. Domenic explains this quite well in
> > the readme of his dict module: https://github.com/domenic/dict
> > 2. Object.getPrototypeOf() is available as a perfect substitution for
> > __proto__. It does exactly what you want, without the security risk.
> > 3. Developers *will* use __proto__ if it is available, and they *will*
> put
> > user data in objects.
> >
> > Here is an opinion:
> >
> > DELETE IT FOREVER!!
> >
> > --
> > --
> > 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.
>
> --
> --
> 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.
>
--
--
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.