These two types of statement are crucial to Eden, distinguishing it from a non-definitive language.
A formula definition has the form:
formula-definition: identifier is expression ;
It is normally expected that the operators appearing in the expression are "pure'' functions, i.e. without side-effect. The interpreter does not allow the use of assignment operators in the expression, but does not otherwise detect the use of "impure'' functions. It is not advisable to use such functions.
In addition, a formula variable cannot be (directly or indirectly) circularly defined. For example,
f is f + 1;
is an error because
f is defined in terms of itself, and not logically meaningful. The definitions:
i is j; j is i;
are syntactically correct, but are conflicting with the restriction. Thus the EDEN interpreter rejects the second definition, and produces the error message:
j : CYCLIC DEF : ABORTED near line ...
The examples below are valid definitions of formula variables (assuming they are not circularly defined):
f is a + b; M is max(a,b,c);
The EDEN interpreter controls all the evaluations of formulae. The order of evaluation is not specified by the language, i.e. can happen in any order. One version of EDEN interpreter may evaluate the formula of
f before that of
M, whenever the value of
a, for instance, is changed, but some other versions may do it in the reverse order. A concurrent EDEN system might do both evaluations in parallel. Therefore, the user should not make any assumption on the order of evaluation.
An action specification has the form:
action-specification: function-declarator dependency-list function-body dependency-list: : identifier-list
The function declarator and function body are the same as those of function definition. An identifier is declared to be an action using the keywords
func. There is no difference between
func; but the user is recommended to use
proc because an action usually serves as a procedure.
The dependency list is a list of comma-separated identifiers preceded by a colon.
An action is normally a procedure invoked automatically by the system when any object specified in the dependency list is changed. No parameters will be passed to the procedure; so the argument list
$ is always empty when called by the system. All values returned by the actions are ignored by the system.
The order of invoking actions is controlled by the EDEN interpreter, but the user can invoke an action explicitly by giving a pair of parenthesis (a null argument list) after the action name (exactly like a procedure/function call). This is useful for debugging.
Notice that if the identifier list is omitted in the dependency list the action is just an ordinary procedure.
The use of actions (and the use of ``impure'' functions as operators in formulae) leads to procedural activity outside the user's direct control when expressions are evaluated. The user should make no assumptions about the order in which such procedural actions are performed. For instance, no two actions that can be invoked in the same time should write to the same RWV. Eden does not provide any facility to detect or prevent such ``interference'' between actions.