fuzion
fuzion copied to clipboard
language improvement: implicit call after parentheses
We can call a function that is the result of an expression in paranthesis explicitly:
> echo "(x).call 7; x i32->unit is v -> say v" | ./build/bin/fz -
7
would be nice to not require the .call as in
> echo "(x) 7; x i32->unit is v -> say v" | ./build/bin/fz -
-:1:5: error 1: Syntax error: expected semicolon ';', found numeric literal '7'
(x) 7; x i32->unit is v -> say v
----^
While parsing: semicolon or flat line break, parse stack: semiOrFlatLF, stmnts, unit
one error.
This works:
echo "x 7; x i32->unit => v -> say v" | ./build/bin/fz -
and i would argue that it is maybe better that this does not work
echo "(x) 7; x i32->unit => v -> say v" | ./build/bin/fz -
I think we should drop this, (expr) arg1 arg2 should not be syntax sugar for (expr).call arg1 arg2.