# Julia 0.6 parametric typealias

**URL:** <https://discourse.julialang.org/t/julia-0-6-parametric-typealias/4093>\
**Category:** General Usage\
**Tags:** question\
**Created:** [June 5, 2017, 7:35pm UTC](https://discourse.julialang.org/t/julia-0-6-parametric-typealias/4093 "2017-06-05T19:35:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tawheeler](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tawheeler/32/17657_2.png) [@tawheeler](https://discourse.julialang.org/u/tawheeler)\
**Post date:** [June 5, 2017, 7:35pm UTC](https://discourse.julialang.org/t/julia-0-6-parametric-typealias/4093/1 "2017-06-05T19:35:11Z")

</div>

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

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

```

When I write

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

```

I get an error.

A minimum reproducible case is:

```julia
Base.Collections.PriorityQueue{String,Int64,Base.Order.ForwardOrdering}

```

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

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [June 5, 2017, 7:37pm UTC](https://discourse.julialang.org/t/julia-0-6-parametric-typealias/4093/2 "2017-06-05T19:37:47Z")

</div>

Hmm:

```julia
julia> struct Foo{A, B} end

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

```

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [June 5, 2017, 7:38pm UTC](https://discourse.julialang.org/t/julia-0-6-parametric-typealias/4093/3 "2017-06-05T19:38:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [June 5, 2017, 7:40pm UTC](https://discourse.julialang.org/t/julia-0-6-parametric-typealias/4093/4 "2017-06-05T19:40:18Z")

</div>

The error message could definitely be made clearer.

---

<div class="post-metadata">

**Author:** ![tawheeler](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tawheeler/32/17657_2.png) [@tawheeler](https://discourse.julialang.org/u/tawheeler)\
**Post date:** [June 5, 2017, 7:42pm UTC](https://discourse.julialang.org/t/julia-0-6-parametric-typealias/4093/5 "2017-06-05T19:42:46Z")

</div>

> [@tawheeler](#):
>
> Base.Collections.PriorityQueue{String,Int64,Base.Order.ForwardOrdering}

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

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [June 6, 2017, 8:35am UTC](https://discourse.julialang.org/t/julia-0-6-parametric-typealias/4093/6 "2017-06-06T08:35:08Z")

</div>

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

```julia
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.
