-
Notifications
You must be signed in to change notification settings - Fork 106
Async arrow syntax #13
Comments
@lukehoban Was there a third issue?
Also, a big plus for this syntax is that it's completely generalizable to other potential function modifiers, should the need arise. |
Also, your syntax doesn't include a paren-free version. I believe it can safely be added like:
I think it would be surprising to leave this form out. What do you think? |
Good points. I agree that this syntax has a nice generalizability. Here's what the proposed grammar extensions would be:
|
Minor points: The async
() is always parsed as a function call (no ASI rules apply). If we're really trying to preserve the option of elided arrow params, do we want to add that second // Successfully parses with ES6 grammar
x = y
=> 1; My personal opinion is that the second |
Opened https://bugs.ecmascript.org/show_bug.cgi?id=2654 on the ES6 point. The feedback at TC39 meeting last week was to keep async arrow sytnax as is, but to stay with the conservative [no LineTerminator here] annotations. |
Several folks have raised concerns about the async arrows syntax in this proposal. In particular:
There are generally two issues:
For the first, the concern is something like:
Under a future proposal that allowed eliding arrow parameter lists, this would have to parse as two statements. So we would need to ensure it was not legal in the current proposal. I believe that can be managed by adding a [NoLineTerminator] between the parameter list and the => of the async arrow grammar. This would additionally mean that async arrows themselves could not elide their parameter lists, as this would be interpreted as a single parameter arrow in ES6 already.
For the 2nd, I personally believe this is syntactically okay. It is challenging to parse since it is not a reserved keyword, but it is possible to do using a cover grammar, and is something implementations can reasonably do. For users, this is very similar to "function", and when colorized in editors as a keyword or contextual keyword will be similarly easy to read.
Opening as issue to track feedback.
The text was updated successfully, but these errors were encountered: