Some questions about Private Name Objects
Kevin Smith
khs4473 at gmail.com
Thu Sep 13 10:59:30 PDT 2012
>
> Another good example where this is a problem is on prototype chains, a
> good example of which you parenthetically noted (iterators). With unique
> names it becomes feasible to hang any properties and methods you want off
> of prototypes without worrying about collision. For instance, imagine an
> persistance lib with a Record.prototype.save method:
>
> var rec = new Record({ save: 'whoops' });
> rec.save() // TypeError: Property 'save' is not a function
>
> And thus we all fall back to the lovely Record.prototype.save.call(rec)
> pattern. Unique names neatly sidestep this, giving us back our prototype
> chains.
>
Interesting - thanks!
Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120913/ece9880a/attachment.html>
More information about the es-discuss
mailing list