I am having difficulty importing functions that have the same name but different signatures from two different modules. It seems to me that I should be able to import both functions, since the signatures are different, but the REPL yells at me. How can I do this?
As a MWE:
module TypeDef
export VariableType
abstract type VariableType end
end
module Mod1
using ..TypeDef
export Foo, TestFcn
mutable struct Foo <: VariableType
x::Float64
y::Float64
function Foo(s::String)
println(string)
return new(x,y)
end
end
function TestFcn(f::Foo, z::Float64)
println("Variables: ", "$(f.x+z)")
end
end
module Mod2
using ..TypeDef
export Bar, TestFcn
mutable struct Bar <: VariableType
x::Float64
y::Float64
function Bar(s::String)
println(string)
return new(x,y)
end
end
function TestFcn(f::Bar, z::Float64)
println("More variables: ", "$(f.y + z)")
end
end
using .TypeDef
import .Mod1: Foo, TestFcn
import .Mod2: Bar, TestFcn
This returns the following:
julia> using .TypeDef
julia> import .Mod1: Foo, TestFcn
julia> import .Mod2: Bar, TestFcn
WARNING: ignoring conflicting import of Mod2.TestFcn into Main