the things you tried didn’t work because @show is a macro and print() takes the string after interpolation. Essentially, @show sees the expression itself, so if you have f(x), all @show can see is something like:
julia> Meta.@dump f(x)
Expr
head: Symbol call
args: Array{Any}((2,))
1: Symbol f
2: Symbol x
and it would simply print out this expression for you and print the result:
julia> @macroexpand @show f(x)
quote
Base.println("f(x) = ", Base.repr(begin
#= show.jl:1040 =#
local var"#14#value" = f(x)
end))
var"#14#value"
end
it’s possible to make @show “understand” $ just like @btime, but it will be manual work because essentially $ is just another node in expression itself:
julia> Meta.@dump f($x)
Expr
head: Symbol call
args: Array{Any}((2,))
1: Symbol f
2: Expr
head: Symbol $
args: Array{Any}((1,))
1: Symbol x