I asked this over at the metaprogramming Slack channel but got no replies, so another try:
I thought all repeated binary operators are parsed as a chain, but apprearently that is not the case:
julia> Meta.show_sexpr(:(a ⊗ b ⊗ c)) (:call, :⊗, (:call, :⊗, :a, :b), :c) julia> Meta.show_sexpr(:(a + b + c)) (:call, :+, :a, :b, :c)
For which operators exactly does that work?
I am not sure it is explicitly documented, but the source suggests that the only operators that do this are +, ++, and *.
+
++,
*
Oh, intersting, thanks.
What is ++ used for? I think I’ve never seen it, but appearently there’s something to it if it is parsed specially.
++
It was used for GitHub - pkofod/PlusPlus.jl
It was a potential generic sequence concatenation operator, but that never really took off. The reason for n-ary parsing is because otherwise concatenating many sequences (e.g. strings) would be inefficient, allocating a temporary for each operator.