PEG purenodefunction--tjl:

Author: Tuomas J. Lukka
Last-Modified:2003-08-17
Revision: 1.3
Status: Accepted

The NodeFunction framework is misused in several places in Fenfire, as there are lots of node functions for which the invariants do not hold.

This PEG suggests a way forwards to both not require too great changes to current code but allow pure functional semantics to be specified and applied.

Issues

System Message: ERROR/3 (../ffdoc/fenfire/pegboard/purenodefunction--tjl/peg.rst, line 19)

Section empty; must have contents.

Changes

Change NodeFunction spec to not specify any invariants for it.

Add a new interface, PureNodeFunction as a subinterface of NodeFunction.

It defines no methods but explicitly defines the invariant.

CachedNodeFunction shall only accept PureNodeFunctions.

PureNodeFunction-implementing classes SHALL BE IMMUTABLE - all members will be final. Changing members will work by creating a new instance with a changed member.