However it can't work in such a  case:

module X
          export f
           g(x) = 2x
           function f(x)
               (current_module()).g(x)
           end
end

module Y
           using X
           export h
           g(x) = 4x
           h(x) = f(x)
end


module Z
  using Y
  println(h(4))
end

On Wed, Feb 17, 2016 at 5:37 PM, Julia Tylors <[email protected]> wrote:

> Yes,
> this worked too, Thank you.!
>
> julia> module X
>           export f
>            g(x) = 2x
>            function f(x)
>                (current_module()).g(x)
>            end
>        end
> X
>
> julia> module Y
>            using X
>            g(x) = 4x
>            println(f(4))
>        end
> 16
> Y
>
> julia> module Z
>            using X
>            g(x) = 5x
>            println(f(4))
>        end
> 20
> Z
>
> On Wed, Feb 17, 2016 at 4:44 PM, Lutfullah Tomak <[email protected]>
> wrote:
>
>> Hi
>> Will this achieve what you want?
>>
>> module Z
>> g()=println("Z.g")
>> function h()
>>     (current_module()).g()
>> end
>> end
>> module X
>> using Z
>> g()=println("X.g")
>> function f()
>>     Z.h()
>>     (current_module()).g()
>> end
>> end
>> module Y
>> using X
>> g()=println("Y.g")
>> X.f()
>> end
>>
>> using Y
>>
>> It prints Y.g twice. Or do you want h() to use X's g()?
>
>
>

Reply via email to