If a I import a function explicitly into a module and extend it with new 
methods, Julia seems to become quite confused when I replace the module, 
adding more methods with exactly the same signatures as the ones already 
there.

I have a complete gist outlining the problem 
<https://gist.github.com/tlycken/ea7781b2eaedccfef12a> (just put all three 
files in the same folder and execute julia demo.jl) but in summary, the 
oddness is shown if you call methods on the extended function after a few 
inclusions:

julia> methods(Foo.bar)
# 8 methods for generic function "bar":
bar(q::Qux) at /home/tlycken/coding/Julia/Baz.jl:11
bar(q::Qux) at /home/tlycken/coding/Julia/Baz.jl:11
bar(q::Qux) at /home/tlycken/coding/Julia/Baz.jl:11
bar(q::Qux) at /home/tlycken/coding/Julia/Baz.jl:11
bar(q::Qux) at /home/tlycken/coding/Julia/Baz.jl:11
bar(q::Qux) at /home/tlycken/coding/Julia/Baz.jl:11
bar(q::Qux) at /home/tlycken/coding/Julia/Baz.jl:11
bar(x) at /home/tlycken/coding/Julia/Foo.jl:6

It still seems to work in this case - bar(Qux(3)) does what it should - but 
I’m having trouble in my real application (where I’m extending layer from 
Gadfly.jl) because I’m getting MethodErrors for signatures that methods say 
are there.

Is this a known problem? I couldn’t find anything in the issue list on 
Github, but I admit that I found it quite difficult to figure out what to 
search for…

// T
​

Reply via email to