@mkarikom wrote:
I need to be able to keep certain arrays of a mixed type (e.g. ImmutableN.n::Array{Int,1}) from being modified. Here is an example:
struct ImmutableN n::Array{Int64,1} cond::Float64 ImmutableN(n) = new(n,rand(1)[1]) end check = ImmutableN([1,2]) check.n[1] = 2 # works (bad)
I googled “julia immutable numeric array” and found this post, but I don’t understand what is going on here. Can someone please clarify this or suggest areas of the documentation that I should check?
Posts: 3
Participants: 2