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

handles

handles

handles provide a means to create handles that refer to update-able
cells.

handles is a state monad. It provides features to create several
handles that refer to modifiable value and features to 'get', 'put' or
'update' this value.

an example of using handles is shown below, handle (singular) is an
alias to initialize a new handle with the given initial value. handle0 T
is the type that allows passing around handles.


the example also shows the difference between handles and the mutate effect:
while both provide a way to store and update a mutable value, a handle can be
passed around between features. meanwhile, mutables are not a type that can be
given to other features, only values can. handles essentially provide an
abstraction of pointers, implemented natively in Fuzion.

Functions

create a new instance with new value refered to by a given handle
get the value refered to by a given handle
return the last handle that was created by 'new'
create a new instance with one additional handle

the new handle can be accessed by 'result.last'
§return(B 
type
, w handles.return.B)
 => 
handles handles.T handles.return.B
:
Any 
has one element been created using 'new'?
create a new instance with the value refered to by a given handle read and
updated.

redefines: