The const
keyword seems to have no effect when used with the destructuring syntax in Julia 1.7+.
julia> t = (;a = 1, b = 2);
julia> const (;a, b) = t
(a = 1, b = 2)
julia> a = 3 # re-definition produces no error or warning, so a is not const
3
So I have to resort to the more lengthy code
const (a, b) = (t.a, t.b)
This was discussed before, but the workaround in a previous post doesn’t / no longer work with either Julia 1.8.0 or 1.7.3 on my computer.
Would it be desirable for Julia to implement the const
annotation as used above? Or is there a language reason that it would be unsound?