Does someone know why the first macro works and the second fails?
macro mymodule(name)
modname = esc(name)
return :(module $modname end)
end
@mymodule MyMod
Works. And the second, using a quote
block does not throwing ERROR: syntax: "module" expression not at top level
(see also https://github.com/JuliaLang/julia/issues/1200):
macro mymodule(name)
modname = esc(name)
return quote module $modname end end
end
@mymodule MyMod