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

Mutable types #1421

Open
awesomekling opened this issue Mar 31, 2023 · 0 comments
Open

Mutable types #1421

awesomekling opened this issue Mar 31, 2023 · 0 comments

Comments

@awesomekling
Copy link
Contributor

Jakt currently does not track mutability of types. Instead, it awkwardly conflates mutability of bindings with mutability of types.

We should split a type T into T and mut T. This would map to T const and T in the generated C++.

let x = get_some<mut T>() should create an immutable binding to a mut T

mut x = get_some<T>() should create a mutable binding to a T

Mutation method calls should only be allowed on mut T values, not T.

Passing a mut T to a function parameter of type T should be allowed.

There are probably other details that need figuring out.

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

No branches or pull requests

1 participant