4 ms·
Eh? This is where I don't follow. What exactly are you recommending should be changed when you say "fix the parser"? Choose the other disambiguation, or simply
by jashkenas 14y ago
Eh? This is where I don't follow. What exactly are you recommending should be changed when you say "fix the parser"? Choose the other disambiguation, or simply use an entirely different function literal in the first place?
For what it's worth, this particular ambiguity was discussed as part of the original language design. It was decided that having parentheses for both argument definitions and argument application was useful parallelism, and that function literals shouldn't have to have a "def", "func", "function", or other prefix. From those two ideas:
# Definition
(input) -> output
# Application
function(input)
... the rest of it falls out naturally.
- johnbender 14y agos/fix the parser/change the parser/, meaning choose not to support both types of invocation.