How much sugar do classes need?
Mark Miller
erights at gmail.com
Tue Dec 2 12:01:42 PST 2008
On Tue, Dec 2, 2008 at 11:35 AM, Jon Zeppieri <jaz at bu.edu> wrote:
>> var self = {
>> toString[]: {|| '<' + self.getX() + ',' + self.getY() + '>'},
>> getX[]: {|| x},
>> getY[]: {|| y},
>> pubInstVar[WE]: 4,
>> pubInstConst[E]: -4,
>> };
>
> I find this ugly, but I don't have any great ideas. I do want to
> point out, however, that one important combination is omitted in
> David-Sarah's proposal (modifier names aside). Private instance
> variables would likely be represented as non-configurable,
> non-enumerable, yet writable properties. I'm guessing that 'x' and
> 'y' (which are suggested by, but left out of the examples above) would
> fit that description.
x and y above are indeed private instance variables, but that's
precisely because they are not properties -- they are normal variables
lexically captured by the functions/lambdas which use them.
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
More information about the Es-discuss
mailing list