Get the name of the invoking module

Right, and in the rare cases where you need this information in a function, you should often have the caller invoke the function via a macro.

For example, define a function foo(m::Module, args...) that takes a module as an argument (like include_string), and then define a macro @foo(args...) that calls foo(__module__, args...).

This way the module to use is unambiguous: it’s the module in whose code the @foo call is located.

3 Likes