The default behaviour of sid
is to do argument passing
using call by copy semantics, and to not allow mutation of parameters of
rules and actions (however inlined rules, and rules created during
factoring have call by reference parameters). However it is possible to
give rule and action parameters call by reference semantics, using the
&
symbol in the type specification (as described
earlier). It is also possible to mutate parameters of actions, using the
@=
substitution in the action body (also described
earlier). It is important to do the correct substitutions in action
definitions, as sid
uses this information to decide where
it can optimise the output code.
If a call by copy parameter is mutated, then sid
will
introduce a new temporary variable and copy the parameter into it - this
temporary will then be mutated. Similar code will be output for rules
that have call by copy parameters that are mutated (e.g. as a call by
reference argument to an action that mutates its parameters).