> var arrowFunction = (a, b) => a+b;
> var generator = (a, b) -> yield a; yield b;
> var async = (a, b) ~> (await a) + (await b);
My thoughts:
Again, generators are not a good fit for arrows - generators define
sequences, not mappings.
Secondly, we should be conservative in our usage of arrow-like operators -
we only have so many decent looking things left!
Third, looking at your third case (and removing unnecessary parens):
var async = (a, b) ~> await a + await b;
It's completely obvious to the reader (by virtue of the await expressions)
that we are looking at an async function. Having a different operator here
offers neither the reader nor the parser any real help. It just makes the
language more grawlixy and less DWIM.
This line of reasoning only applies to async arrows, and not to async
function declarations, expressions, or methods. Again, arrows are by
nature syntax-light and tolerate a higher degree of "inference" than other
forms.
My point is that we should reserve "await" within arrows to preserve these
design options down the road. It can always be unreserved later.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss