## Mutable variant types

The argument of a value constructor can be declared ``mutable'' when the variant type is defined:

            type foo = A of mutable int
                     | B of mutable int * int
                     | ...

This allows in-place modification of the argument part of a constructed value. Modification is performed by a new kind of expressions, written ident `<-` expr, where ident is an identifier bound by pattern-matching to the argument of a mutable constructor, and expr denotes the value that must be stored in place of that argument. Continuing the example above:

            let x = A 1 in
              begin match x with A y -> y <- 2 | _ -> () end;
              x

returns the value `A 2`. The notation ident `<-` expr works also if ident is an identifier bound by pattern-matching to the value of a mutable field in a record. For instance,

            type bar = {mutable lbl : int};;
            let x = {lbl = 1} in
              begin match x with {lbl = y} -> y <- 2 end;
              x

returns the value `{lbl = 2}`.