Skip to content

Modules and multiple Dispatch #4540

@ingmarschuster

Description

@ingmarschuster

Either there is a parametric knot in my head by now or there are problems with julias multiple dispatch and how it interacts with modules.
the following code snippet

module As
    export aT, aTfunc
    abstract aT{T1, T2}

    function aTfunc{T1 <: Int64, T2}(bI::aT{T1, T2})
             println("called aTfunc")
             bfunc(bI)
    end

end

module Bs
    export bT, bfunc
    using As
    type bT <: aT{Int64, Float64}
             c::Int64
    end

    function bfunc(bI::bT)
             println("called bfunc")
    end

end

using As, Bs

aTfunc(bT(5))

does not work in Commit 5f6c86c* (0.2.0-rc1+7).

while the same thing without modules

abstract aT{T1, T2}

type bT <: aT{Int64, Float64}
         c::Int64
end

function aTfunc{T1 <: Int64, T2}(bI::aT{T1, T2})
         println("called aTfunc")
         bfunc(bI)
end

function bfunc(bI::bT)
         println("called bfunc")
end

aTfunc(bT(5))

works as expected. I see what the technical reasons might be in the case with modules, still as far as I see it, multiple dispatch should work across module boundaries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions