Julia 0.6 parametric typealias



I am having trouble changing a typealias from julia 0.5 to a const declaration in Julia 0.6:

typealias MyType Vector{PriorityQueue{Vector{Int}, Float64}}

When I write

const MyType = Vector{PriorityQueue{Vector{Int}, Float64}}

I get an error.

A minimum reproducible case is:


which throws “ERROR: TypeError: Type{…} expression: expected UnionAll, got Base.Collections.#PriorityQueue”.
Is there a new way for declaring this?
Thank you!



julia> struct Foo{A, B} end

julia> const MyType = Vector{Foo{Vector{Int}, Float64}}


Aha, the problem is that the struct PriorityQueue has been moved out of Base. What is left is just a function which you can’t typealias.


The error message could definitely be made clearer.


Ah, looks like it is in DataStructures.jl now.


Because PriorityQueue has a third type parameter, you might consider defining this particular typealias as

const MyType{O} = Vector{PriorityQueue{Vector{Int}, Float64, O}}

Otherwise you’re defining a vector with abstract eltype. There are indeed situations where the abstract version is useful, and where something more concrete won’t even work; but when all the elements of that vector have the same ordering, you’ll probably be happier with the O version.