I see that the precedence of operation is specified here and if i understand correctly the operations higer in the file have higer precedence, so ~ being at the top has higest precedence. Also using Base.operator_precedence I see that
And indeed, you can define ~ as a binary function:
julia> :(a ~ b)
:(a ~ b)
julia> Base.:(~)(a, b) = a + b
julia> 3 ~ 4
7
The reason that it has assignment precedence was mainly intended for domain-specific languages via metaprogramming/macros, since ~ has an “assignment-like” meaning in statistics. In fact, ~ was originally a special “metaprogramming-only” binary operator that expanded into a macro call: Make tilde automatically quote its arguments · Issue #4882 · JuliaLang/julia · GitHub
Unary operator precedence, on the other hand, is handled differently, and unary operators are higher precedence than * but are trickier for ^. See e.g.