Re:Should function arguments be reassignable or mutable?
by cuspycode on Monday January 01, 2018 @10:46AM
(#16046466)
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.
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.