I see, name wasn’t escaped:
macro def(name, definition)
return quote
macro $(esc(name))()
esc($(Expr(:quote, definition)))
end
end
end
@def test begin
a = 2
end
# Now @test "pastes" the code `a=2`
is good now.