# Strange re-typing of arrays of numbers

**URL:** <https://discourse.julialang.org/t/strange-re-typing-of-arrays-of-numbers/51603>\
**Category:** New to Julia\
**Tags:** question, type, dispatch\
**Created:** [December 10, 2020, 12:55pm UTC](https://discourse.julialang.org/t/strange-re-typing-of-arrays-of-numbers/51603 "2020-12-10T12:55:59Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![FPGro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fpgro/32/20822_2.png) [@FPGro](https://discourse.julialang.org/u/FPGro)\
**Post date:** [December 10, 2020, 1:51pm UTC](https://discourse.julialang.org/t/strange-re-typing-of-arrays-of-numbers/51603/3 "2020-12-10T13:51:48Z")

</div>

This happened twice now in a short time. Compare:

> [@Types, strange behavior](https://discourse.julialang.org/t/types-strange-behavior/51384):
>
> Julia Version 1.5.3 (2020-11-09) Hi, looking at this vector=[[1,2],[3,[4,5]]] vector[1] typeof(vector[1]) julia\> vector=[[1,2],[3,[4,5]]] 2-element Array{Array{Any,1},1}: [1, 2] [3, [4, 5]] julia\> vector[1] 2-element Array{Any,1}: 1 2 julia\> typeof(vector[1]) Array{Any,1} Is there a good reason Julia cannot define the type to be Vector{Int64}?

Should there be a warning in the docs? Like, for example, here:

[https://docs.julialang.org/en/v1/manual/arrays/#man-array-literals](https://docs.julialang.org/en/v1/manual/arrays/#man-array-literals)

Something along the lines of:

"Remember, promotion to a common type may also change the type of nested arrays:

```julia
julia> arr = [Int[1,2],[]]
3-element Array{Array{Any,1},1}:
 [1, 2]
 []

julia> arr[1]
2-element Array{Any,1}:
 1
 2

```

To prevent this, declare an abstract type for the containing array:

```julia
julia> arr2 = Any[[1,2],[]]
3-element Array{Any,1}:
 [1, 2]
 Any[]

julia> arr2[1]
2-element Array{Int64,1}:
 1
 2

```

"

---

_[View the full topic](https://discourse.julialang.org/t/strange-re-typing-of-arrays-of-numbers/51603)._
