Closed
Description
I'm writing a macro tha packs it's parameter and @FILE into a NamedTuple and push it into a Vector, like this:
testvec=Vector{NamedTuple{(:f,:s),Tuple{Int,String}}}()
# push!(testvec,(f=0,s="abc"))
macro testm(a)
return quote
b=a+1
push!(testvec,$(esc(
(f=b,s=@__FILE__)
)))
end
end
@testm 2
My think is to try avoiding other ways than esc to prevent f
and s
from being renamed, or to make b work in escaped environment. However I tried $(esc(b))=a+1
and other escape forms, with none of them succeeded.
Any suggestions?