abulak
February 28, 2019, 11:15am
1
I’m facing the following issue:
I have a module TestModule end
and I’d like to add a new sub-module to it.
so let me try:
julia> @eval TestModule Module(:A)
Main.A
julia> TestModule.eval(:(Module(:B)))
Main.B
I’m probably missing something very obvious…
Maybe one of the following will help you:
julia> module TestModule
end
Main.TestModule
julia> @eval TestModule module A end
Main.TestModule.A
julia> TestModule.eval(:(module B end))
Main.TestModule.B
julia> name = :C ;
julia> TestModule.eval(:(module $name end))
Main.TestModule.C
abulak
March 1, 2019, 9:34pm
3
the actual problem I was having was that You can not quote module (since quote introduce a node in ast), so that TestModule.eval(quote module B end end))
produces ERROR: syntax: "module" expression not at top level
.
but I got to Expr
solution after.
anyway, thanks!