Some workarounds:
- introduce a wrapper type for
matrix:mutable struct ReplaceableMatrix matrix::Matrix{Float64} end struct MyType some_field::SomeType matrix::ReplaceableMatrix end - make
MyTypemutable with all fields immutable, except formatrix:mutable struct MyType const some_field::SomeType matrix::ReplaceableMatrix end
It would be possible to add a resize! method for Array, however, as some have pointed out, the desired semantics of such a method would not be obvious (what should happen to the existing elements).