So export MyType, foo, bar
and using SomeLibrary is not enough? How do I change it to be more specific? On Fri, Aug 1, 2014 at 12:50 PM, Jameson Nash <[email protected]> wrote: > Since you haven't explicitly imported MyType.bar, when you defined bar > again, it created a new, unrelated function Main.bar, rather than merging > them > > > On Friday, August 1, 2014, Dustin Lee <[email protected]> wrote: > >> 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 >> >> -- Dustin Lee qhfgva=rot13(dustin)
