Comment by 4ad
2 years ago
That only works if your language is value-oriented, but most existing languages use references and mutation extensively.
2 years ago
That only works if your language is value-oriented, but most existing languages use references and mutation extensively.
I think that's too broad and somewhat outdated. C++ has const, for example, and you're expected to use it. Java and C# give you final/readonly, and not only that, but immutability is becoming more idiomatic, with the language increasingly encouraging it. For example, in modern C#,
is immutable, whereas the mutable equivalent is the much more verbose:
Java goes even further by not even having syntax for mutable records - if you want something like that, you have to write it out as a regular class.
To reason about programs one can't consider only the good features and forget about the bad ones.
But yes, it's good that languages are moving in this direction.