On Wednesday, September 7, 2016 at 5:34:16 PM UTC-6, eksperimental wrote:
>
> thank you Michał, but __ENV__ holds no information about imported modules. 
> I will be calling the macros/funtions with no module, so somehow I need to 
> figure out which Module 
> I'm going to be calling the macro/function from 
>

Uh, you sure it does not hold the information?
```elixir
iex> import Ecto.Query
iex> __ENV__.macros[Ecto.Query]
[distinct: 2, distinct: 3, from: 1, from: 2, group_by: 2, group_by: 3,
 having: 2, having: 3, join: 3, join: 4, join: 5, limit: 2, limit: 3, lock: 
2,
 offset: 2, offset: 3, order_by: 2, order_by: 3, preload: 2, preload: 3,
 select: 2, select: 3, update: 2, update: 3, where: 2, where: 3]
```
You should be able to just iterate through `__ENV__.macros` to find which 
module the macro belongs to.  There is also a `__ENV__.functions` for that 
one too.  Just remember to use the __ENV__ in the environment where you 
will be calling it in, not from the callee environment.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-talk/9ea61b2d-1015-4981-9b21-0b03eee69f67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to