2 ms·
imho the "def" keyword saves it from being too ambiguous, since it's clearly defining a function/method. def [functionname] = [body] seems fine to me. The
by Pxtl 3y ago
imho the "def" keyword saves it from being too ambiguous, since it's clearly defining a function/method.
def [functionname] = [body]
seems fine to me. The big flaw (that it can't tell the difference between the end of the body and the end of the statement line) would be the same with any token, I think.
From what I'm seeing, though, they should've made parentheses mandatory around [body] until they could fix the parser problem. They could easily make them optional in some hypothetical future where they've corrected the issue.
That said, it seems like C# wins at solving this problem, where the `=>` syntax is used for both lambdas and one-liner functions.