getter & setter for private objects

memolus at memolus at
Mon Nov 2 15:05:09 PST 2009

2009/11/2 Brendan Eich <brendan at>:
>Defining accessors on an activation object is nasty,
>If you want private getters and setters, you can put them in an object denoted by a private var:
So you prefer ugly solutions, because the others are nasty?

> The upshot for memolus is that with is already a deoptimizer that introduces
> non-lexical names onto the scope chain. These can be gettters and setters
> and have arbitrary effects. My point remains that adding getters and setters
> to activations, which are modeled lexically in the absence of eval, in
> strict mode in ES5, and under other such conditions, is a non-starter.

I didn't get how to use "with" in order to use private objects
(non-lexical names onto the scope chain). Just ignore my example if it
tries to add getter and setter to already activated objects. You don't
have to implement it this way.

More information about the es-discuss mailing list