My original intention was to ask if there was any way we could declare a const array who's elements are also constants. Since the following is possible: julia> const a = [1,2,3] 3-element Array{Int64,1}: 1 2 3
julia> a[1] = 2 2 and it would be useful to have arrays that are as constant as a variable can be, without the need of declaring a new immutable type. For instance, can we have an immutable Dict, who's fields AND their values are const? Const arrays would be nice though. On Monday, September 15, 2014 12:09:25 AM UTC+10, gael....@gmail.com wrote: > > I may have missed something but wouldn't > immutable t > x > y > end > > immutable t > x > y > end > > type u > x > y > end > work? > > julia> myvar = t(1,2) > julia> myvar.x=5 > ERROR: type t is immutable > julia> v = u(t(1,2), t(3,4)) > u(t(1,2),t(3,4)) > julia> v.x > t(1,2) > v.x=t(5,6) > t(5,6) > v.x.x=42 > ERROR: type t is immutable > > If you really want to guaranty constant fields, you have to type them to > some constant type. >