Two kinds of [] (was: Re: shortcuts for defining block-local private names, plays nicely with @foo syntax)

Herby Vojčík herby at
Tue Jan 24 04:02:12 PST 2012

Allen Wirfs-Brock wrote:
> On Jan 23, 2012, at 1:14 PM, Herby Vojčík wrote:
>> Axel Rauschmayer wrote:
>>>> Losing generic [] as a way to access all "native" properties of the
>>>> object is big price.
>>> ... For the few remaining cases, Object.getProperty() (or
>>> something similar) should do just fine.
>> Hm. Well, maybe you are right.
>> But it gets harder with getters and setters... maybe if there was an
>> API for simulating proper legacy foo[bar] and foo[bar]=baz,
>> (Object.get, Object.set?) generic [] could be dropped without much of
>> a loss.
> It sounds like you need to read
> Allen

Sorry. I have read it, but not studied in detail. I remembered the main 
idea only (the [] overloading).

"A side note on reflective property access" does the trick.



More information about the es-discuss mailing list