I love the (a=4) syntax which both assigns a variable and returns its value, for example:
vector = [(a=1+2+3)+4+5, a+4+5]
there is also a very similar syntax used in named tuples, (a=4,) which creates a tuple with a named element a. this is also useful since it lets you use keyword arguments:
function sample(a, b; word1, word2)
[word1, a, word2, b]
end
sample(word2=3, 2, 4, word1=1)
however, these two syntaxes fight with eachother, and the second usually wins:
sample(word2=3, (a=2), a+2, word1=1)
#error: unsupported keword argument a
it appears that the parens are interpreted as precedence clarification, but since commas are already the lowest precedence, it doesnât do anything, and âsimplifiesâ itself down to sample(word2=3, a=2, a+2, word1=1), which is an error. if someone actually meant to clarify precedence intent, they would likely do
sample(word2=3, a=(2), a+2, word1=1)
since this currently does nothing, could âparens assignmentsâ in function calls be fixed, or would that be considered a breaking change?