Attribute defaults for Object.defineProperty

Jeff Watkins watkins at apple.com
Fri Aug 22 09:00:01 PDT 2008


On 22 Aug, 2008, at 8:04 AM, Allen Wirfs-Brock wrote:
> Jeff Watkins <Watkins at apple.com> said:
>> because I'd love to see a delete added to get and set for properties.
>
> Don't quite understand what you are asking for here?

I can already define a getter and a setter for properties, I'd like to  
be able to specify a deleter. Using the syntax proposed the other day  
(which I really like):

var o= {

     get foo: function()
     {
         // ...
     },

     set foo: function(newFoo)
     {
         // ...
     },

     delete foo: function()
     {
         // ...
     }
};

I can think of a couple situations where this would be nice,  
specifically around creating proxies for other objects. The only  
drawback is that 'foo' in o always returns true.


More information about the Es-discuss mailing list