buzz icon indicating copy to clipboard operation
buzz copied to clipboard

Immutability by default

Open giann opened this issue 2 years ago • 2 comments

Should things be immutable (and private) by default?

str hello = "hello";
hello = "bye"; | fails

var str hello = "hello";
hello = "bye"; | ok

giann avatar Jul 06 '23 11:07 giann

Hard big YES. Not only that "others" are doing it for years now, but enforcing immutability on a compiler level brings a lot of safety out of the box.

It may eventually lead to questions of "borrowing & ownership" (arrived in Swift 5.9, present in Rust since v1) but that's another subject.

Imho, this should be by default.

vexy avatar Sep 04 '23 10:09 vexy

Enforcing immutability should be relatively straightforward. Implementing this should also pave the way to resolve/implement:

  • #155
  • #145
  • #114
  • #52
  • #14
  • #13

giann avatar Sep 04 '23 11:09 giann