On Tue, Jun 7, 2011 at 1:19 PM, Gavin Barraclough <[email protected]>wrote:
> Ah, good point, I hadn't considered anonymous classes. Clearly we could
> solve this with a solution specific to these cases (say, "class(){ /*...*/
> }" for anonymous class constructors?), but having mismatching syntax in
> these cases would be a little unfortunate.
>
That might work, but has the same problem as "new" I believe, where "class"
is a valid property name. It also might be a bit confusing if we later add
support for nested classes.
For what it's worth, I find "constructor" painfully long, but it seems to be
the best solution. I definitely prefer using a single standard token instead
of the class name. I hate having to type the same thing twice, especially if
I'm writing a class WithSomePainfullyLongNameWhichSadlyDoesOccurInPractice.
Just for kicks, here's an even more radical idea: no name at all:
class Monkey {
() {
log("I am the monkey's constructor.");
}
}
class Point {
(x, y) { this.x = x; this.y = y; }
}
It's delightfully terse, but also completely foreign and non-obvious. I'm
90% certain this is a terrible idea.
- bob
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss