Re: getter & setter for private objects

2009-11-14 Thread memo...@googlemail.com
manager = function(object) { this.init.apply(this, arguments); } manager.prototype = new function() { /* Private Properties */ var gui; var obj; /* Constructor */ this.init = function(object) { gui = new Gui(); obj = object;

Re: getter & setter for private objects

2009-11-04 Thread Brendan Eich
Use-cases, please -- aesthetics come after functionality and only if the functionality is there. You haven't demonstrated why you want accessors on the lexical (i.e., private part of the) scope chain. /be On Nov 4, 2009, at 5:50 AM, memo...@googlemail.com wrote: So if you agree with me u

Re: getter & setter for private objects

2009-11-04 Thread memo...@googlemail.com
So if you agree with me upon the ugliness, you'll also agree with me that it would be better to find a sweeter way. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: getter & setter for private objects

2009-11-02 Thread David-Sarah Hopwood
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 memo...@googlemail.com wrote: > 2009/11/2 Brendan Eich : > >> 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 solution

Re: getter & setter for private objects

2009-11-02 Thread Mike Samuel
2009/11/2 memo...@googlemail.com : > 2009/11/2 Brendan Eich : >>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 fo

Re: getter & setter for private objects

2009-11-02 Thread Brendan Eich
On Nov 2, 2009, at 3:05 PM, memo...@googlemail.com wrote: 2009/11/2 Brendan Eich : 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?

Re: getter & setter for private objects

2009-11-02 Thread memo...@googlemail.com
2009/11/2 Brendan Eich : >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 deoptimi

Re: getter & setter for private objects

2009-11-02 Thread Brendan Eich
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 e

Re: getter & setter for private objects

2009-11-02 Thread Mike Samuel
2009/11/2 Brendan Eich : > On Nov 2, 2009, at 10:47 AM, Mike Samuel wrote: > >> What do getters and setters do around with? >> >>  var flipFlop; >>  with ({ get test: function () { return (flipFlop = !flipFlop) ? >> 'flip' : 'flop'; } }) { >>    for (var i = 0; i < 10; ++i) { alert(test); } >>  } >

Re: getter & setter for private objects

2009-11-02 Thread Brendan Eich
On Nov 2, 2009, at 10:47 AM, Mike Samuel wrote: What do getters and setters do around with? var flipFlop; with ({ get test: function () { return (flipFlop = !flipFlop) ? 'flip' : 'flop'; } }) { for (var i = 0; i < 10; ++i) { alert(test); } } The with block invokes NewObjectEnvironmen

Re: getter & setter for private objects

2009-11-02 Thread Mike Samuel
What do getters and setters do around with? var flipFlop; with ({ get test: function () { return (flipFlop = !flipFlop) ? 'flip' : 'flop'; } }) { for (var i = 0; i < 10; ++i) { alert(test); } } The with block invokes NewObjectEnvironment with O being the binding object. But I'm uncl

Re: getter & setter for private objects

2009-11-02 Thread Brendan Eich
On Nov 2, 2009, at 2:34 AM, memo...@googlemail.com wrote: I like to use getter and setter on private objects (e.g. "var test"). That is very unclear; I'm guessing you mean getters and setters instead of plain variables in closures used to store private data. I didn't found any way to do

getter & setter for private objects

2009-11-02 Thread memo...@googlemail.com
I like to use getter and setter on private objects (e.g. "var test"). I didn't found any way to do this. I don't need sth. like Object.definePrivateProperty, because I only want to set getter and setter when I define the private object. Example proposal: var test; get test = function() { [..] }; s