Right now Julia has a convention that every function that mutates its parameters is marked with
! but it has several downsides :
- It is just a convention - we rely on programmer’s good will and we all know what does that mean. (Especially when deadlines appear.)
- It doesn’t tell you which argument is being mutated so you will have to specify those mutable arguments explicitly in documentation instead. (Again another convention…)
On top of that making mutability explicit looks even more promising when you consider that :
- It enables further optimizations.
- It makes code less prone to error. It is easier to reason about code.
- It is generally believed to be the right style: Experienced C programmers mark parameters with
constwhenever they can. Rust does that and even Julia itself recently moved from mutable structs to immutable structs.
Although it is not a big change for compiler it is totally not backward compatible so the final decision should be made before 1.0 comes out…