Testing a string macro

Except that esc is a hammer that should be used with care:

macro x_str(str, suf)
    return esc(:($str * xx[$suf]))
end

macro y_str(str, suf)
    return :($str * $(esc(:xx))[$suf])
end
julia> let xx = Dict("a" => "orange"), * = tuple
           @show x"tasty "a
           @show y"tasty "a
       end;
x"tasty "a = ("tasty ", "orange")
y"tasty "a = "tasty orange"
2 Likes