Object.prototype.get & bye bye Object.defineProperty

Andrea Giammarchi andrea.giammarchi at gmail.com
Thu Nov 29 12:23:45 PST 2012


I will ... but I still would like to know why other developers are using
inheritance for this.

No memory, performance, size, benefits and more verbose code, i.e.

Object.defineProperty(o, p, Object.create(null, {value:{value:v}}))

OR

Object.defineProperty(o, p, new DefaultDescriptor(v));

VS

Object.defineProperty(o, p, {value:v})

So, let's say I am starting evangelizing this here.

br



On Thu, Nov 29, 2012 at 11:16 AM, Brendan Eich <brendan at mozilla.org> wrote:

> Andrea Giammarchi wrote:
>
>> I really don't understand what is exactly the advantage of considering
>> inherited properties for descriptors.
>>
>
> It's easy to overreact here. Don't mess with Object.prototype still
> applies, or you will have other WTF moments.
>
> ES5 shipped this and browsers shipped implementations. David and others
> use it. I don't think we can change it.
>
> The ES5 meta-object APIs are pretty much power-tools, with obvious
> verbosity and usability taxes. Better (more concise and usable) veneer on
> top has been done and should bubble up on github. This is not to excuse
> anything, but any process (standardized de-jure or not) that releases
> platform iterations to millions of developers will face this pain. Node.js
> is facing it now.
>
> So I say doc this, evangelize it, and build better APIs on top of ES5.
> TC39 people are tracking.
>
> /be
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121129/a0696867/attachment.html>


More information about the es-discuss mailing list