Yes, I noticed the title changed after your post from “… v1.0”, I think.
I tried pressing “Summarize This Topic”, but it seems not working, maybe a permission issue for me? If anyone can, explaining 1.0 (for breaking changes) vs. 1.x, meaning 1.1+ (for most ideas in the thread, that are not needed and need not strictly make it for 1.0) might be in order.
And possibly list some non-breaking/package examples that people still want to get into 1.0, e.g. debugger…
Listing some examples (not that I want them in the summary…):
Did you mean for 1.0, can this be non-breaking?
0-dimensional Array{Float64,0}:
1.0
For some relevant types or these ones as an example, you would want Array{Union{Float64,Int32},0}. That would keep type-stability (just not sure the compiler could (as an optimization) or should give it for that exact code).
[Note it’s not really useful here to get a Union as every Int32
(but not Int64
) is a subset of Float64, just discussion the general principle to avoiding type-instability (that can be useful to have). Also let’s say you go with Unions, it might be a problem to get ever bigger Unions… if you do similar to this on Union values…]
The Union infrastructure (made for Nulls), would also allow you to give you Union{Int32, Float64} ? Since for Nulls at least, it’s implemented by an array of your values first, and then an array indicating Nullness, I’m not sure this would work for scalars; or would give two trivial arrays of one value each… I guess both the values values from each “array” could be optimized into two CPU registers, but not sure; can an array be “bitstype”?
This works:
julia> x=now > 2018 ? Union{Int32, Float64} : Float64
Union{Float64,Int32}
so I guess this is just an error that could be gotten around:
julia> x=ones(now > 2018 ? Union{Int32, Float64} : Float64)
ERROR: MethodError: Cannot `convert` an object of type Int64 to an object of type Union{Float64,Int32}
This may have arisen from a call to the constructor Union{Float64,Int32}(...),
since type constructors fall back to convert methods.
in one(::Type{Union{Float64,Int32}}) at ./number.jl:64
in ones(::Type{T}) at ./array.jl:169