Closed edwjusti closed 5 years ago
I don't think that saving a single character is enough justification for a new syntactic form.
I agree that in terms of characters you don't save much with that syntax, but I found it a lot clearer that way especially with async functions or maybe even getters and setters.
People are already using thefetchData = async () =>
and have become accustomed to it. Having two different syntaxes that are about equally concise and do exactly the same thing is likely to be more confusing than helpful, and would also introduce further possibility of confusion with regular method syntax.
I understand, this is just a personal preference and can possibly introduce confusion among other developers. In my mind I imagined being able to use that syntax for more things besides async functions, like getters & setters in one line, or async iterators with lexical scope. But this would require other semantics and behavior changes in order to add that syntax with those other features which differs from regular class fields.
I don't know if this question fits this proposal and repository, or if it's already been discussed before but it is closely related to class fields. But would it be possible to add a shorthand for fields declarations that use arrow functions like in dart so that we could omit the the assignment operator with the field if we are declaring an arrow function?