3 ms·
> This is an idea I got that isn't really implemented > in any language I know of. Is this different than an arg declared as a const reference in C++. Or s
by jonhohle 8y ago
> This is an idea I got that isn't really implemented
> in any language I know of.
Is this different than an arg declared as a const reference in C++. Or since fields are still mutable, like `final` arguments in Java?
- amedvednikov 8y agoI think yes, it's like declaring every single argument as const.
- bakul 8y agoAlgol68 had this property. Consider STRUCT (INT x, y) z = (1, 2) Here z is a const struct. If you wanted a variable, you'd have to say STRUCT (INT x, y) z; z := (1, 2) or equivalently REF STRUCT (INT x, y) z = LOC STRUCT (INT x, y) := (1, 2) Basically a variable has a REF mode.