# Type stability problem with NamedTuple of Union{T,Missing}

**URL:** <https://discourse.julialang.org/t/type-stability-problem-with-namedtuple-of-union-t-missing/17514>\
**Category:** General Usage\
**Created:** [November 14, 2018, 1:00pm UTC](https://discourse.julialang.org/t/type-stability-problem-with-namedtuple-of-union-t-missing/17514 "2018-11-14T13:00:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabiangans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fabiangans/32/2624_2.png) [@fabiangans](https://discourse.julialang.org/u/fabiangans)\
**Post date:** [November 14, 2018, 1:00pm UTC](https://discourse.julialang.org/t/type-stability-problem-with-namedtuple-of-union-t-missing/17514/1 "2018-11-14T13:00:43Z")

</div>

Does anyone have an idea how to make the following function type-stable?

```julia
function extracttuple(a,b,i)
    (a=a[i],b=b[i])
end

a=zeros(Union{Float64,Missing},10)
b=zeros(Union{Float64,Missing},10)
@code_warntype extracttuple(a,b,1)

```

`code_warntype` returns `Any` as a return type, while I would have hoped/expected something like `NamedTuple{(:a,:b),Tuple{Union{Missing,Float64},Union{Missing,Float64}}}` Any hints or links to already existing issues would be appreciated.

---

<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:** [November 14, 2018, 1:02pm UTC](https://discourse.julialang.org/t/type-stability-problem-with-namedtuple-of-union-t-missing/17514/2 "2018-11-14T13:02:45Z")

</div>

Maybe [https://github.com/JuliaLang/julia/issues/29970](https://github.com/JuliaLang/julia/issues/29970) is good to track.
