Hello Julia Users,

I'm new to Julia and came across some behaviour of Julia, related to 
methods, I didn't expect.

Case A) In the REPL, when I define two methods, I get the behaviour I 
expect:

julia> f(s::String) = "Some operation with a String";
julia> f(b::Bool) = "Some operation with a boolean";
julia> f
f (generic function with 2 methods)

So far, so good.

Case B) Now if I have a file with this code and load it in to a fresh REPL 
session (using 'include'):

module A
export f
f(s::String) = "Some operation with a String";
end 

module B
export f
f(b::Bool) = "Some operation with a boolean";
end

 then, when stating 'using A' and 'using B', I get a warning that there is 
a conflict with an existing f:

julia> using A
julia> f
f (generic function with 1 method)
julia> using B
Warning: using B.f in module Main conflicts with an existing identifier.
julia> f
f (generic function with 1 method) 

I would have expected that Julia would see this as the same method with two 
different argument definitions, just  like in Case A).
I have multiple modules that define the same methods for different 
composite types, which seems a normal way of working to me.

What am I doing wrong? The way Julia currently handles this seems incorrect 
to me ...

I'm interested to hear your input!

Kind regards,

Freddy

PS : I'm on Julia Version 0.3.0-prerelease+584 (2013-12-19 22:26 UTC), 
Commit 06458fa* (2 days old master), x86_64-apple-darwin13.0.0


Reply via email to