Home    Reference > F Functions > Assign
prev next

Description

The expression
   a := b
is desugared to
   Assign(a,b)

Function Assign

@x:func Assign(a,b)~void
a the target of the assignment.
b the value to be assigned.

Semantics

The Assign function has special assignment semantics. The value of b is assigned to the location specified by a. The first parameter a can be either a variable or a function call to a function that is a LHS/RHS function pair. For the function pair, the LHS function is called after adding the value of b as an extra actual parameter. It is also common to for a to be a sugared form of LHS/RHS function call such as a subscripting operation or a dot qualification operation.

Examples


   @x:var a := 3;
   @x:var b := rec();
   a := 7; // assigns 7 to a
   b.x#rec := 5; // desugared to b.sys:Dot#rec["x"](5)