This feature is a part of the roadmap. If you forget to flag a variable as mut, the compiler should catch it, and let you know that you have mutated something you may not have intended to mutate.
Specification
Add mut modifier to the grammar and declaration statement. In semantics check if variables are mut or not, and allow assignments only on mutable ones.
Example:
field mut a = 0
a = 1 // allowed
field b = 0
b = 1 // not allowed
Motivation
This feature is a part of the roadmap. If you forget to flag a variable as
mut
, the compiler should catch it, and let you know that you have mutated something you may not have intended to mutate.Specification
Add
mut
modifier to the grammar and declaration statement. In semantics check if variables aremut
or not, and allow assignments only on mutable ones.Example:
Backwards Compatibility
Seems like a breaking change.