# Type stable Dict to hold Array{Float64, N} with variable N

**URL:** <https://discourse.julialang.org/t/type-stable-dict-to-hold-array-float64-n-with-variable-n/5647>\
**Category:** General Usage\
**Created:** [August 31, 2017, 1:11am UTC](https://discourse.julialang.org/t/type-stable-dict-to-hold-array-float64-n-with-variable-n/5647 "2017-08-31T01:11:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joaquimg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joaquimg/32/223_2.png) [@joaquimg](https://discourse.julialang.org/u/joaquimg)\
**Post date:** [August 31, 2017, 1:11am UTC](https://discourse.julialang.org/t/type-stable-dict-to-hold-array-float64-n-with-variable-n/5647/1 "2017-08-31T01:11:56Z")

</div>

Is there any nice way to make such Dict type stable (where N might vary in different dict entries)?

Perhaps annotating when accessing some field (which I always know the size)

Or have a dict of `Tuple(Vector{Float64},Vector{UInt32})` the second vector could keep count of dim sizes so that I can use `ind2sub/sub2ind`. This looks very messy and possibly inefficient…

thanks

---

<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:** [August 31, 2017, 4:30am UTC](https://discourse.julialang.org/t/type-stable-dict-to-hold-array-float64-n-with-variable-n/5647/2 "2017-08-31T04:30:58Z")

</div>

Annotating when accessing seems like a good idea (see: [https://docs.julialang.org/en/latest/manual/performance-tips/#Annotate-values-taken-from-untyped-locations-1](https://docs.julialang.org/en/latest/manual/performance-tips/#Annotate-values-taken-from-untyped-locations-1) ) .

But if you have a Dict with heterogeneous types, and you know the type of each field, then maybe a `struct` would be a better solution?
