An implementation in Smalltalk 75
Figure 5.1 Some of the messages sent during constraint assertions and solving.
Some of the messages that are sent when executing constraint assertions and solve-methods are shown in Figure 5.1. The assertion messages are sent by some application domain objects. The assertion methods create instances of UnevaluatedConstraint and store them in constraint stores. Unevaluated constraints basically contain the blocks to which assertion messages are sent. When an application domain object A sends a solve- or propagate-message to another application domain object B, the object B collects a set of dynamically asserted constraints and sends them to the execution context, which is also an object, for solving. The execution context solves them together with the statically asserted constraints by sending the evaluate message to each of the unevaluated constraints which in turn sends the value message to the block it contains.
The following example shows how cells are used and how constraint assertions and solving methods are executed.
Example 5.1. First, a class CRectangle is defined which uses cells to store the position of the left, right, top, bottom edges.
instance variables: top, bottom, left, right
^super new initialise