Suppose that I define two functions using \oplus(x::Int, y::Int)
and \otimes(x::Int, y::Int)
. Is it possible to define an evaluation order for these operations? For example, so that 1 \oplus 2 \otimes 3
equals 1 + 2* 3
.
I believe the operator precedence is hard coded: https://docs.julialang.org/en/v1/manual/mathematical-operations/#Operator-Precedence-and-Associativity
Is the associativity also hard coded? No way to change them?
yes
imagine you have two packages, both defining an \oplus
for their type - the decision for associativity needs to be made before types are known, so how could Julia decide which to use?
Makes sense. Thanks @Sukera
Last updated: Nov 06 2024 at 04:40 UTC