# What's with the invariant parametric types gotcha?

**URL:** <https://discourse.julialang.org/t/whats-with-the-invariant-parametric-types-gotcha/55090>\
**Category:** New to Julia\
**Created:** [February 11, 2021, 8:32pm UTC](https://discourse.julialang.org/t/whats-with-the-invariant-parametric-types-gotcha/55090 "2021-02-11T20:32:29Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [February 11, 2021, 8:45pm UTC](https://discourse.julialang.org/t/whats-with-the-invariant-parametric-types-gotcha/55090/3 "2021-02-11T20:45:19Z")

</div>

> [@DevJac](#):
>
> Is it just a syntax decision?

No, the syntax really isn’t the core of the issue here. A `Vector{Integer}` is a real type, and one you might even use at some point, it’s just that `[1, 2, 3]` doesn’t give you one.

A `Vector{Integer}` is a vector in which every element can be a (potentially different) subtype of `Integer`:

```julia
julia> x = Vector{Integer}()
Integer[]

julia> push!(x, 1)
1-element Array{Integer,1}:
 1

julia> push!(x, big(2)^big(100))
2-element Array{Integer,1}:
                               1
 1267650600228229401496703205376

```

This is different from `Vector{Int64}` in which every element is exactly the concrete type `Int64`. It’s also different from `Vector{<:Integer}` which is a _set_ of types describing any `Vector` whose element type is any subtype of `Integer`. `Vector{Int64}` and `Vector{Integer}` are both members of that set:

```julia
julia> Vector{Int64} <: Vector{<:Integer}
true

julia> Vector{Integer} <: Vector{<:Integer}
true

```

but they have no relationship to one another otherwise:

```julia
julia> Vector{Int64} <: Vector{Integer}
false

```

```julia

```

---

_[View the full topic](https://discourse.julialang.org/t/whats-with-the-invariant-parametric-types-gotcha/55090)._
