Skip to content

Mutable types #1421

Open
Open
@awesomekling

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions