One such recent, long discussion can be found at https://groups.google.com/forum/?hl=en#!topic/julia-users/sk8Gxq7ws3w.
I will also take this opportunity to plug shamelessly for my "package" https://github.com/davidagold/MetaMerge.jl that allows you to merge functions. For your example, so long as you have a function f defined in the module from which you call fmerge!, you can do fmerge!(f, (A, f), (B, f)) and now the function f (as defined in the module in which fmerge! is called) will have both methods. On Saturday, May 23, 2015 at 10:56:56 AM UTC-4, Gabriel Goh wrote: > > 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? >
