Skip to content

Parametric Types with internal constructors should generate an outer helper constructor by default #8234

@tawheeler

Description

@tawheeler

Right now, parametric types with inner constructors require one to specify the data type:

type TypeB{S}
    x::Array{S}
    y::Int
    TypeB(x::Array{S}) = new(x,2)
end
TypeB{Int}([1,2,3])

It would be nice if an outer helper constructor was auto-generated for such cases:

type TypeB{S}
    x::Array{S}
    y::Int
    TypeB(x::Array{S}) = new(x,2)
end
TypeB{S}(x::Array{S}) = TypeB{S}(x)
TypeB([1,2,3]) # <- {Int} not require

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