I have a module
MyTest which has a function
f with two methods. From the REPL, I can define and extend a function
f in successive definitions. Now I want to export
f in my module so that both methods are exposed when I call
using MyTest. Below is the example:
function f(x::Number) return x^2 end ## f (generic function with 1 method) function f(x::Number, p::Integer) return x^p end ## f (generic function with 2 methods)
module MyTest include("funcs.jl") export f end # module
When I run
using MyTest, I get the following error:
WARNING: Method definition #f(Any, typeof(MyTest.f)) in module MyTest overwritten.
What am I missing? Thanks!