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

Lars Hansen lhansen at adobe.com
Mon Mar 17 13:31:24 PDT 2008


> -----Original Message-----
> From: Kris Zyp [mailto:kris at sitepen.com] 
> Sent: 13. mars 2008 18:14
> To: Lars Hansen; Mark S. Miller
> Cc: es4-discuss at mozilla.org
> Subject: Deleting Getters and Setters (was Re: Controlling 
> DontEnum...)
> 
> > the fact; getters and setters defined by an object initializer or in
a 
> > class are fixtures and hence not deletable.
>
> Really, that doesn't create a compatibility problem? I 
> realize getters and setters aren't in ES3, but this seems 
> like ES4 would be making a significant departure in behavior 
> from the majority of current browser implementations of the 
> same getter/setter syntax used by ES4:
> >>> obj = {get foo() { return 'hi' }}
> Object foo=hi
> >>> obj.foo
> "hi"
> >>> delete obj.foo
> true
> >>> obj.foo = 'goodbye'
> "goodbye"
> >>> obj.foo
> "goodbye"
> 
> With ES4, obj.foo would still be returning "hi" at the end? 
> That sounds nice, but is there no fear of compatibility 
> issues with that?

It's an interesting point.  The proposal is here:
http://wiki.ecmascript.org/doku.php?id=proposals:getters_and_setters
but does not mention deletion (either way).

Brendan, opinions?

--lars



More information about the Es4-discuss mailing list