I recently noticed that StridedArray
is a Union
that is not const
. I usually make my unions const
like other globals that I declare, but now I'm wondering if it actually matters or not.
In modern versions of julia, writing a type alias with the curly brackets has an implicit const
.
julia> Foo{T} = Union{Vector{T}, Tuple{T, Int}}
Union{Vector{T}, Tuple{T, Int64}} where T
julia> Foo{T} = Union{Vector{T}, Tuple{T, Int, Int}}
ERROR: invalid redefinition of constant Foo
I forget when we added this behaviour
Cool. I never noticed.
Would be nice to list such things under ?const
Last updated: Dec 28 2024 at 04:38 UTC