Skip to content

parametrized typealias inconsistently creates subtype relation #8625

Closed
@StephenVavasis

Description

If a parametrized type is created by typealias, is it a subtype of the unparametrized type? Here is an example showing that Julia is inconsistent about this question. If I run this in the latest dev version of Julia, the first println yields "false" whereas the second yields "true". By the way, I don't know what the 'correct' answer is to the question.

module testnestparam3

immutable Token{T}
    container::T
end

typealias ArToken{T} Token{Array{T,1}}

println("ArToken{Int} <: ArToken = ", 
            ArToken{Int} <: ArToken)

println("Vector{Float64} <: Vector = ",
        Vector{Float64} <: Vector)

end

kms Edit: formatting

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    types and dispatchTypes, subtyping and method dispatch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions