Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    > 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?


I think yes, it's like declaring every single argument as const.


Algol68 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: