Joshua 've updated your question on Stack Overflow: http://bit.ly/1wz5n5U 

You could also generalize this line:

module_files = filter(r"^mod[0-9][0-9].jl$", readdir())

By abstracting it into a function:

julia> module_files(dir=".") = filter(r"^mod[0-9][0-9].jl$", readdir(dir))
module_files (generic function with 2 methods)

So you may use it like this:

julia> @dynamic_import module_files()


Cheers!
Ismael VC 



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
>

Reply via email to