I'm totally in agreement with Jeremy's "class id objectLiteral" proposal, but
for one thing: don't give up on your function definition syntax yet!
I really don't see any reason for adding a new way to define function
(methods). This:
class Runner {
run(a) {
}
}
is just as clearly expressed as this:
class Runner {
run: function(a) {
}
}
Granted, if we went with the latter, there's slightly more to type BUT 1) it's
immediately clear to all JavaScript developers what's going on and how to work
with it and 2) there are already several good proposals for function definition
shorthands (arrow syntax and block lambdas). As I said on the github thread, we
need to take a holistic view here and not lose sight of its effects on the rest
of the language. For example, with block lambdas:
class Runner {
run: {| a |
}
}
Introducing yet another syntax for creating a function feels like bloat to me.
Also, I bet we would start seeing a lot of "run(a){…}" attempts at function
definitions in a non-class context.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss