It seems this should work:
julia> function f(x, y) (x, y) end
ERROR: syntax: space before "(" not allowed in "f(x, y) ("
Of course, removing the space is not the solution here!
julia> function f(x, y)(x, y) end
ERROR: syntax: invalid function name "f(x, y)"
The same happens with array litterals too.
I think this error is ok for now, because function f(x)(y) is actually sensible syntax for defining a curried function, i.e. f(x)(y) = 0 means f(x) = y -> 0. We could make that work instead.
It definitely is not urgent to fix this. But even with a new curried function definition syntax, this is still distinct from the reported error here, which involves a space. I think I prefer two close syntaxes (with/without space) meaning different things than a special case (preventing a parenthesised expression as the body of a function defined like in the OP).
Most helpful comment
I think this error is ok for now, because
function f(x)(y)is actually sensible syntax for defining a curried function, i.e.f(x)(y) = 0meansf(x) = y -> 0. We could make that work instead.