3 ms·
Historical anecdote: Algol-68 disassociated variable assignment from mutability already 50 years ago. Whenever mutability was desired, a reference to a mutable
by cuspycode 9y ago
Historical anecdote: Algol-68 disassociated variable assignment from mutability already 50 years ago. Whenever mutability was desired, a reference to a mutable value holder was used.
Example of immutable assignment: int n = 2
Example of reference to mutable value: ref int n = (heap int := 2)
However, in order to make Algol-68 code look more similar to Algol-60, they introduced backwards-compatible shorthands, so for example the declaration int n; was actually a shorthand for ref int n = (loc int);
This shorthand magic probably contributed to why Algol-68 syntax was perceived to be difficult.
Footnote: loc and heap were the two memory allocation operators available in Algol-68.
- sli 9y agoRust takes a similar approach with let some_var and let mut some_var, respectively.