Fuzion Logo
flang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

mutate

🌌mutate

mutate -- an effect that permits creation and mutation of mutable values.

This effect is typically used to work with mutable values. You can create
a mutable value as follows

v := mutate.env.new i32 42

and then modify it using

v <- 666

To read it, call 'get' as in

say "v is {v.get}"

Convenience feature 'mut' and type inference allow the creation to be
written as

v := mut 42

NYI: syntax sugar to read mutable field using

w := v + 1

instead of

w := v.get + 1

is not supported yet.

create a new mutable value with the given initial value and update the
'mutate' effect in the current environment