# Use cases for type lower bounds

**URL:** <https://discourse.julialang.org/t/use-cases-for-type-lower-bounds/10071>\
**Category:** General Usage\
**Tags:** question\
**Created:** [March 30, 2018, 11:33am UTC](https://discourse.julialang.org/t/use-cases-for-type-lower-bounds/10071 "2018-03-30T11:33:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 30, 2018, 11:33am UTC](https://discourse.julialang.org/t/use-cases-for-type-lower-bounds/10071/1 "2018-03-30T11:33:54Z")

</div>

One can specify lower bounds for `UnionAll` types in `v0.7` with `>:`.

I was trying to think about examples where I would use this feature, but could not come up with any. Looking at the sources in `Base`, I found [this one](https://github.com/JuliaLang/julia/blob/8a5f74724cdbf422ec6f7666c15aa1c8c2bba5ab/base/missing.jl#L106), the rest of the applications look like compiler internals and tests.

If someone could explain some patterns that one would use `>:` for, or link some examples, I would be interested. My motivation is just trying to place a new language feature in my toolbox.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [September 13, 2018, 6:44pm UTC](https://discourse.julialang.org/t/use-cases-for-type-lower-bounds/10071/2 "2018-09-13T18:44:29Z")

</div>

One use case was mentioned in

> [@X::Vector{Union{Missing, Any}}](https://discourse.julialang.org/t/x-vector-union-missing-any/14896/4):
>
> Indeed, since (as its name indicates) Any can be any value, including missing. In general, use ::AbstractArray{\>:Missing} to define a method which should be called for any array which can contain missing. But note that in many cases you can just define a single generic method, knowing that the compiler will (often) optimize out ismissing(A[i]) calls when the array cannot contain missing.

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [September 14, 2018, 8:01am UTC](https://discourse.julialang.org/t/use-cases-for-type-lower-bounds/10071/3 "2018-09-14T08:01:56Z")

</div>

I guess `AbstractArray{>:T}` would also be useful in all cases where a function stores a value of type `T` inside an array provided as an argument. I’m not sure how common this is in practice, though.
