Julia: Heterogeneous Array literals promote row by row

Created on 4 Oct 2017  ·  2Comments  ·  Source: JuliaLang/julia

This surprised me:

julia> [1 "two"; 3im 4.0; 5 6//1]
3×2 Array{Any,2}:
    1           "two"
 0.0+3.0im  4.0+0.0im
   5//1       6//1

I would have expected promotion to have been completely disabled since there's a string in there. Is this the expected behavior? Is it useful? Should we change it?

arrays

Most helpful comment

Agree, this seems like a bug to me.

All 2 comments

Agree, this seems like a bug to me.

Also agree, we should change it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omus picture omus  ·  3Comments

TotalVerb picture TotalVerb  ·  3Comments

i-apellaniz picture i-apellaniz  ·  3Comments

omus picture omus  ·  3Comments

StefanKarpinski picture StefanKarpinski  ·  3Comments