FUNCTIONAL. Event
guards are restricted to be FUNCTIONAL, so that the
dispatcher
can freely optimize their execution.
Definition
An FUNCTIONAL procedure or method is not allowed to call
a non-FUNCTIONAL procedure or method. Only the base
library routines that do not modify global state are defined as
FUNCTIONAL. (We have identified "functional" procedures
as FUNCTIONAL as needed.)
A FUNCTIONAL procedure or method has the following
additional restriction on its behavior:
- It cannot assign to a global.
- It cannot dereference and assign a pointer.
- It cannot assign to a
VAR parameter.
Syntax
The keyword PROCEDURE can be preceded by the keyword
FUNCTIONAL, both in a procedure type or a procedure
definition. A method name in an object type can be preceded by
FUNCTIONAL.
Examples
FUNCTIONAL PROCEDURE f(a, b: INTEGER) : INTEGER =
BEGIN
RETURN a+b;
END f;
PROCEDURE g(VAR a: INTEGER) = (* cannot be FUNCTIONAL *)
BEGIN
a := 5; (* modifies global state! *)
END g;