I thought I understood how expression interpolation worked. This works as expected:
julia> sym = :a
:a
julia> :(b > $sym)
:(b > a)
But when I try to interpolate an operator into an expression, I get a weird syntax error:
julia> op = :-
:-
julia> :(1 $op 2)
ERROR: syntax: missing comma or ) in argument list
julia> op = :<
:<
julia> :(1 $op 2)
ERROR: syntax: missing comma or ) in argument list
I guess (without any deep understanding of what’s going on) interpolation happens after lowering.
So :(b > $sym) is first lowered to :(>(b, $sym)) and then interpolation happens. Whereas :(1 $op 2) is invalid syntax because it doesn’t recognize $op as an infix operator.