macro modcreate(name)
Expr(:module, false, esc(name::Symbol), Expr(:begin))
end
On Thu, Jul 3, 2014 at 12:00 AM, Eric Davies <[email protected]> wrote:
> Hi all,
>
> I'm working on a multipass configuration file package and I'm having
> difficulty executing my ideas (I'm not great at the metaprogramming stuff
> yet). I want to create a baremodule in a macro and have it available to the
> scope containing the macro. I want to be able to pass the name of the
> baremodule as an argument to the macro. Unfortunately, every (probably
> terrible) strategy I try seems to give the error "name not defined" (where
> name is the argument to the macro containing the desired module name).
>
> I want it to work like this (toy example):
>
> julia> @modcreate foo
>
> julia> typeof(foo)
> Module
>
> Can anyone suggest possible contents for the macro that might produce the
> above behaviour?
>
> Thanks,
> Eric
>