On Thu, 2014-06-12 at 22:52, [email protected] wrote: > I can get the module of an exported method like so: > ``` > julia> module BB > export B2, cc, f > type B2 > a > end > f(x) = x+3 > cc = 5 > end > > julia> using BB > > julia> Base.function_module(f) > BB > ``` > How can I do the same for the datatype `B2` and the variable `cc`? (as > a bonus, what about macros?)
For the datatype it is: julia> B2.name.module For variable bindings, Julia knows about it, as it displays a warning: julia> cc = 1 Warning: imported binding for cc overwritten in module Main This originates from the function `jl_get_binding_wr` in `src/module.c`, which shows that a binding as a `owner`. I'll try and figure out how to get to it. For marcos it seems impossible to get hold of them without them being evaluated.
