Shouldn't the macro evaluate it automatically? I think we need way more metaprogramming documentation.
julia> @dynamic_import ["Newton.jl", "MyTest.jl"] :($(Expr(:toplevel, :($(Expr(:import, :Newton))), :($(Expr(:import, :MyTest )))))) julia> eval(ans) julia> Newton Newton julia> MyTest MyTest El lunes, 29 de diciembre de 2014 21:45:45 UTC-6, Joshua Adelman escribió: > > I'm attempting to do some dynamic module loading and subsequent processing > and can't quite figure something out. I think I have a reasonable (albeit > maybe not idiomatic) mechanism for dynamically importing a set of modules. > See my stackoverflow question and the subsequent self answer: > > http://stackoverflow.com/q/27696356/392949 > > My next question is, after I've dynamically/programmatically imported a > bunch of modules, is there a way of iterating over that set of modules? > Specifically, if I store the module names as strings (e.g. ["mod00", > "mod01", "mod02"]) and each module contains some function `func` that isn't > exported, how would I call `mod00.func()` if I only know the string > "mod00"? I think this comes down to converting the string to a Module type, > but I'm not sure and haven't come up with something workable after a few > passes through the docs. > > Any suggestions would be very much appreciated. > > Josh >
