On 3/2/2016 10:48 PM, Nick Coghlan wrote:
I'm personally not averse to adding new syntactic sugar for lambda expressions, but if we did do something like that, I'd advocate for just stealing Java's spelling (perhaps with the addition of mandatory parentheses, ala generator expressions):
https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html#s...
The rationale for that would be:
1. "(params -> expr)" is easier on the eyes than "lambda params: expr"
One qualifier on that: to meet the deliberate LL(1) parsing constraint on the language grammar, the actual syntax would probably need to be "(def params -> expr)" Generator expressions and comprehensions don't need an introductory token as the first child node is an ordinary expression, so the parser doesn't need any advance notice of the larger construct. That isn't the case with a parameter list - those have special parsing rules to allow things like default arguments, *args, and **kwds. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia