`Mutable_Array` should expect type parameter `M type : mutate`
See idiom 196 for an example: Currently, it is possible to create a function that expects a Mutable_Array but not the mutate type this array was created for. This is in principle ok since static analysis will find the required actual heir of mutate from the actual value passed as a ref, but it is not so nice to hide this.
It might be better to not have Mutatble_Array as a ref type at all, but use mutate.array instead so we have an implicit dependency on the mutate type and a feature using such an array could then be declared as
foo(M type : mutate, a M.array i32) ! M => a[3] := 42
where mutate.array.set [](i i32, v T) is implemented at mutate.this.env.set_array i v, such that the code of foo is equlvalent to
foo(M type : mutate, a M.array i32) ! M => M.env.set_array 3 42
I am confused about the set_array feature that pops up in your example. Where does it come from?
I am also pretty sure this has at least partly been addressed by 4bb52c730cd4f8edce7a62cc8aff939c1e9057ed, cc @michaellilltokiwa.
solved by now