I'm doing some development and wondered if this kind of pattern is 
problematic:

abstract AbstractNode
abstract PhylogenyNode <: AbstractNode
abstract NetworkNode <: AbstractNode
abstract AbstractEdge
abstract PhylogenyEdge <: AbstractEdge
abstract NetworkEdge <: AbstractEdge

type Branch{N <: PhylogenyNode} <: PhylogenyEdge
    from::N{Branch}
    to::N{Branch}
    length::Float64

    function Branch{N}(::Type{N})
        x = new()
        length!(x, -1.0)
        return x
    end
end

type Clade{E <: PhylogenyEdge} <: PhylogenyNode
    from::E
    to::Vector{E}
    confidence::Float64

    function Clade{E}(::Type{E})
        x = new()
        x.to = Vector{E}()
        confidence!(x, -1.0)
        return x
    end
end



As you can see both concrete types are parametric, and as a result there is 
a certain circularity to it 
Clade{Branch{Clade{Branch{Clade{Branch}}}}}.... That ultimately ends in 
something like Clade{Branch{N<:PhylogenyNode}}. I'd like to know if this is 
type-certain or not - the fact it terminates in N<:PhylogenyNode or 
E<:PhylogenyEdge makes me doubt it.

Reply via email to