Given two files:
SomeLibrary.jl
===============
module SomeLibrary
export MyType, foo, bar
abstract MyType
function bar(mt::MyType)
println("I'm in MyType/bar")
mt.x * 3
end
function foo(mt::MyType)
bar(mt) + 1
end
end
main_program.jl
===============
using SomeLibrary
type NewType <: MyType
x
end
function bar(nt::NewType)
println("I'm in NewType/bar")
nt.x * 2
end
println(foo(NewType(10)))
When running main_program.jl I'd expect:
I'm in NewType/bar
But instead I get
I'm in MyType/bar
So I guess my expectations are a little messed up. I'm hoping someone can
help me think through the logic of scoping here.
Why isn't the more specific type function being used?
I'm on Julia 0.3.
thanks