Finding a "safety syntax" for classes

Claus Reinke claus.reinke at
Fri Mar 23 15:20:46 PDT 2012

>> - would it make sense to name the constructor after the class
>>   (avoiding 'constructor' and 'new')?

That seems to be a 'no', then:-) It might be useful to document
such obvious but rejected options, with counterarguments:

- repeated name
- readability/search concerns (constructor determined non-locally,
    by class name matching)
- what to do about anonymous classes?
- preempts class name as prototype property

The various arguments revolving about names and anonymous
classes suggest another alternative:

- use an anonymous function declaration in the class as the 
    class constructor

Again, I'm not arguing in favor or against, I'm only looking
for alternative design options.


More information about the es-discuss mailing list