Interpolate into macro like BenchmarkTools

question
macros

#1

With @btime it is possible to interpolate values, how can I replicate this in other macros?

julia> x = 8
8

julia> @btime $x
  0.027 ns (0 allocations: 0 bytes)
8

julia> macro fun(expr)
           return esc(expr)
       end
@fun (macro with 1 method)

julia> @fun $x
ERROR: syntax: "$" expression outside quote

#2

The $ thing is specific to BenchmarkTools: