Skip to content

No way to change mutable fields of a tag arm. #135

Closed
@froystig

Description

@froystig

Suppose we have

type foo = tag(arm(mutable int));

The language binds identifiers in alt patterns as slots-local-to-the-case-block with value copied from the one sitting in the tag type. That is:

let foo farm = arm(5);
alt (farm) {
    case (arm(x)) {
        /* x is a local slot holding 5 here, assigning to
           it does not change the value in farm */
        x = 6;
    }
}

This is possibly counterintuitive. Maybe x should be an alias (caveat emptor: may require extra care). In any case, we probably want to support some kind of way of writing to these fields, if we are going to allow them to be marked mutable.

Metadata

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