# What's the correct way to including functions that only got introduce from a certain version of Julia?

**URL:** https://discourse.julialang.org/t/whats-the-correct-way-to-including-functions-that-only-got-introduce-from-a-certain-version-of-julia/39379
**Category:** New to Julia
**Created:** [May 13, 2020, 6:48am UTC](https://discourse.julialang.org/t/whats-the-correct-way-to-including-functions-that-only-got-introduce-from-a-certain-version-of-julia/39379 "2020-05-13T06:48:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)
#### Post date: [May 13, 2020, 6:48am UTC](https://discourse.julialang.org/t/whats-the-correct-way-to-including-functions-that-only-got-introduce-from-a-certain-version-of-julia/39379/1 "2020-05-13T06:48:04Z")

</div>

I want to support all LTS Julia versions which is currently 1.0.5. However, some functions like `nonmissingtype` is only introduced in 1.3

What’s the correct way to support these type of functions? Should I just check for Julia version in PacakgeName.jl and then if they are not there then with something like this?

```julia
if VERSION < v"1.3.0"
  using Missings: nonmissingtype
end

```

---

<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: [May 13, 2020, 10:53am UTC](https://discourse.julialang.org/t/whats-the-correct-way-to-including-functions-that-only-got-introduce-from-a-certain-version-of-julia/39379/2 "2020-05-13T10:53:40Z")

</div>

Yes, this is a common approach. But presumably you want some fallback for versions before if the code actually uses `nonmissingtype`.

I think the cleanest approach is to just require the Julia version you need in the `[compat]` section, and drop support for versions before.

---

<div class="post-metadata">

### Author: ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)
#### Post date: [May 13, 2020, 11:17am UTC](https://discourse.julialang.org/t/whats-the-correct-way-to-including-functions-that-only-got-introduce-from-a-certain-version-of-julia/39379/3 "2020-05-13T11:17:50Z")

</div>

I want to support any LTS Julia version, so unless LTS becomes like 1.4, I will continue to support it.

---

<div class="post-metadata">

### Author: ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)
#### Post date: [May 13, 2020, 2:14pm UTC](https://discourse.julialang.org/t/whats-the-correct-way-to-including-functions-that-only-got-introduce-from-a-certain-version-of-julia/39379/4 "2020-05-13T14:14:01Z")

</div>

I think the “best” solution is to add it to `Compat` and write `using Compat: nonmissingtype`; i.e., let `Compat` implement the branch. This way, other people can also use `Compat` for this.

Though `if VERSION < v"1.3.0"` looks like a good solution too.
