Deleting Getters and Setters (was Re: Controlling DontEnum...)

Brendan Eich brendan at mozilla.org
Mon Mar 17 15:07:07 PDT 2008


On Mar 17, 2008, at 2:36 PM, Brendan Eich wrote:

> 1. getter function x() { return ++i; };
> 2. o = {x getter: function () { return ++this.i; }};
> 3. o = {i: 0}; o.x getter= function () { return ++this.i; };
>
> The first two were changed long ago, with Waldemar guiding things,
> into the ES4 syntax the RI supports today:
>
> 1'. function get x() { return ++i; };
> 2'. o = {get x() { return ++this.i; };
>
> SpiderMonkey supports only form 2', while still maintaining support
> for the original 1-3.
>
> Form 3 became
>
> 3': o = {i: 0}; o.__defineGetter__('x', function () { return +
> +this.i; });

Only in SpiderMonkey, I should have added -- the RI and of course ES4  
do not specify support for __define[GS]etter__.

/be




More information about the Es4-discuss mailing list