I pretty sure it will only works for expressions that are parsed as a call
expression, for example:
julia> Meta.@dump x * y
Expr
head: Symbol call
args: Array{Any}((3,))
1: Symbol *
2: Symbol x
3: Symbol y
julia> Meta.@dump x.y
Expr
head: Symbol .
args: Array{Any}((2,))
1: Symbol x
2: QuoteNode
value: Symbol y
As you can see, it doesn’t work with something like the .
operator because is specially parsed. One limitation that i thinked of was the use of where
, but you can still use it with this syntax if you wrap the expression with parenthesis:
julia> x::T ± y::T where {T <: Number} = (x + y, x - y)
ERROR: UndefVarError: T not defined
Stacktrace:
[1] top-level scope
@ REPL[16]:1
julia> (x::T ± y::T) where {T <: Number} = (x + y, x - y)
± (generic function with 1 method)
julia> 2 ± 3
(5, -1)