ES accessor usage guidelines (Was: Map/Set.prototype.size)

Brendan Eich brendan at mozilla.com
Tue Oct 16 16:12:29 PDT 2012


Yehuda Katz wrote:
> I feel somewhat strongly that this is an appropriate use of a setter. 
> Using a method would give the API a static language feel for not 
> enough win. In the case of a well-defined API with well-understood 
> links between objects, a setter feels right to me.

I'm not super-religious here. In fact I suspect we (TC39, or any 
non-trivially small group formed from es-discuss participants) will not 
agree on "one true way".

JS is multi-paradigm. We're not as TimToady 
(http://en.wikipedia.org/wiki/There%27s_more_than_one_way_to_do_it) as 
Perl but we are definitely not narrow and pedagogical and prescriptive.

So maybe we should look for least common denominator rules. 
Map/Set.prototype.size as accessor still wins by any such.

/be


More information about the es-discuss mailing list