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

Add const / non-mutable variables #74

Open
Zettelkasten opened this issue Jan 6, 2022 · 0 comments
Open

Add const / non-mutable variables #74

Zettelkasten opened this issue Jan 6, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@Zettelkasten
Copy link
Owner

We still need to discuss some syntax for this. Maybe val/var as in Kotlin or so. Or simply const like here:

func foo() {
  const x: Int = 6
  x = 5  # not allowed, because = needs a reference to the target
}

These variables are then not alloca'ed as a Ref[T] but directly as T.
Then, all enforcements follow automatically as local variables are not special in any way currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant