Closed
Description
opened on Mar 8, 2017
per https://discourse.julialang.org/t/is-this-expected-behavior-0-5-to-0-6-breakage/2534/7
In 0.5:
julia> a = Vector{UInt32}([0x01, 0x02, 0x03])
3-element Array{UInt32,1}:
0x00000001
0x00000002
0x00000003
julia> a + 1
3-element Array{UInt32,1}:
0x00000002
0x00000003
0x00000004
In 0.6:
julia> a = Vector{UInt32}([0x01, 0x02, 0x03])
3-element Array{UInt32,1}:
0x00000001
0x00000002
0x00000003
julia> a + 1
3-element Array{Int64,1}:
2
3
4
(Is there a reason this change was made? FWIW, I prefer the old behavior. Changing the type out from under me broke a bunch of things, most significantly some code for generating random graphs:
Base.dSFMT.dsfmt_gv_init_by_array(MersenneTwister(seed).seed+1)
Unless you know that MersenneTwister
's seed is a Vector{UInt32}
, you wouldn't know that adding 1
to it would cause a type change and subsequent failure. Ironically, if it were a Vector{Char}
, everything would have just worked:
julia> a = Vector{Char}(['a','b','c'])
3-element Array{Char,1}:
'a'
'b'
'c'
julia> a + 1
3-element Array{Char,1}:
'b'
'c'
'd'
I couldn't find anything in NEWS.md on this change, so at a minimum, I think a note would be warranted if this new behavior is intended.
Metadata
Assignees
Labels
No labels
Activity