How do I do this …
verbosity_tags = [....]
macro noise(tag, args...)
return :( if $tag in verbosity_tags; println("$(basename(@__FILE__)): $(@__LINE__): ", $(esc.(args)...)); end )
end
in such a way that @FILE & @LINE are expanded at the point @noise is used rather than at the point it is defined.
It seems clear that they should be wrapped in another layer of quoting to delay the expansion however my naive attempts to do so have failed.
I did manage to achieve what I wanted by assembling the macro body by hand using Expr et al. but that’s a rather clumsy way to do a pretty trivial thing.
jon.