@mort I don't see a point in getting rid of curly braces, since if your lambda is not the last argument, you'll have to wrap the whole thing in parens (cause comma operator), which is even worse, but I agree that the return and the extra semi colon are painful sometimes. Maybe something like [] () -> (expr) could work? As far as I know the type after arrow can't start with a paren, so it's not ambiguous.
@mort I see, I guess it's not really a problem with function parameters, but it feels like there are going to be edge cases where it could behave unexpectedly.
That said it could be that I just don't like what javascript does. In that log example I'm inclined to pivot on => and group everything on either side of it together.
foo([](a,b) => a + bar(a, b), c) // kind of blends together
vs
foo([](a,b) -> (a + bar(a, b)), c) // c looks more isolated
@namark Allowing the comma operator at the end would be painful with my proposed syntax, yeah. The way other languages have solved it is to just ignore the comma operator at the top level there; in JavaScript, `console.log(() => 10, 20)` prints `[Function] 20`, so the comma is interpreted as an argument separator, not as a comma operator.
This is actually consistent with other cases in C++; C++ will treat `foo(a, b)` as a call with the arguments a and b, and doesn't call a.operator,(b).