Consider the following:
module A export foo whoami() = "A" foo() = whoami() end module B using Main.A whoami() = "B" end B.foo() # "A"
I understand why that’s the case but is there a way to call
A.foo "in the context of
B" i.e. effectively calling
B.whomai() and returning
"B"? (short of re-defining
foo manually in
B). I tried using
@__MODULE__ in the definition of
foo but either used it incorrectly or it’s not the right way to go.
The following does part of what I want but I’d like not to modify
A outside of the scope of
module B using Main.A; import Main.A.whoami whoami() = "B" end B.foo() # "B" ok A.foo() # "B" nok