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

> I also like to explicitly declare immutability/ mutability

Scala takes this approach, using var for declaring mutable variables, and val for declaring immutables. In my experience, in well designed imperative code, only a small proportion of variables need mutation, so using keywords like const and final is backward. It would make more sense to use a mutable keyword, or to do as Scala does. (C++ has a mutable keyword, but it's for a different purpose.)

https://docs.scala-lang.org/overviews/scala-book/two-types-v...



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

Search: