Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immutability by default #139

Closed
giann opened this issue Jul 6, 2023 · 2 comments
Closed

Immutability by default #139

giann opened this issue Jul 6, 2023 · 2 comments
Labels
immutability Issue related to immutability and constantness language Issue related to the language proposal Something we consider doing
Milestone

Comments

@giann
Copy link
Collaborator

giann commented Jul 6, 2023

Should things be immutable (and private) by default?

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

var str hello = "hello";
hello = "bye"; | ok
@giann giann added language Issue related to the language proposal Something we consider doing labels Jul 6, 2023
@giann giann added this to the 0.4.0 milestone Aug 3, 2023
@vexy
Copy link

vexy commented Sep 4, 2023

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.

@giann
Copy link
Collaborator Author

giann commented Sep 4, 2023

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

@giann giann added the immutability Issue related to immutability and constantness label Sep 20, 2023
@giann giann modified the milestones: 0.4.0, 0.5.0, 0.6.0 May 14, 2024
giann added a commit that referenced this issue Dec 9, 2024
giann added a commit that referenced this issue Dec 10, 2024
giann added a commit that referenced this issue Dec 10, 2024
giann added a commit that referenced this issue Dec 10, 2024
giann added a commit that referenced this issue Dec 10, 2024
giann added a commit that referenced this issue Dec 10, 2024
giann added a commit that referenced this issue Dec 11, 2024
giann added a commit that referenced this issue Dec 11, 2024
giann added a commit that referenced this issue Dec 11, 2024
giann added a commit that referenced this issue Dec 18, 2024
giann added a commit that referenced this issue Dec 19, 2024
giann added a commit that referenced this issue Dec 19, 2024
giann added a commit that referenced this issue Dec 19, 2024
giann added a commit that referenced this issue Dec 19, 2024
giann added a commit that referenced this issue Dec 19, 2024
giann added a commit that referenced this issue Dec 20, 2024
giann added a commit that referenced this issue Dec 27, 2024
giann added a commit that referenced this issue Dec 27, 2024
giann added a commit that referenced this issue Jan 13, 2025
@giann giann closed this as completed in ca14d8a Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
immutability Issue related to immutability and constantness language Issue related to the language proposal Something we consider doing
Projects
None yet
Development

No branches or pull requests

2 participants