Hey all,

I'm wondering if you guys could educate me on the correct way to overload 
functions in modules. The code here doesn't work:

# ******************************************************

module A

type apple
end

export apple,f

f(x::A.apple) = println("I am apple");

end

# ******************************************************

module B

type orange
end

export orange, f

f(x::B.orange) = println("I am orange");

end

using A
using B

f(apple())
f(orange())

I expect julia to print "I am apple" and "I am orange", but instead I get

ERROR: `f` has no method matching f(::apple)

Any clues?

Reply via email to