On Wed, Mar 2, 2016 at 10:51 AM, Cedric St-Jean <[email protected]> wrote:
> Hi, I have a situation that looks a bit like this:
>
> module A
> function foo end
> end
>
> module B
> import A: foo
> macro define_foo(typ, value)
> :(foo(::$(esc(typ))) = $(esc(value)))
:(A.foo(...) = ...)
> end
> end
>
> module C
> using B: @define_foo
> @define_foo Int 19
> end
>
> A.foo(20)
>
> In other words, A is defining a function foo, B defines a macro to define
> methods of foo, and C uses the macro. This looks like it should work, but it
> doesn't, because hygiene takes over and `foo` gets replaced with a gensym in
> its expansion, since it's on the left-hand-side of an equality. Is there any
> way around this?