This examples shows the declaration of a Complex module object

Complex: =
   Complex(re: ?integer, im: ?integer): Value
      + C: ?Complex -> res: ?Complex:
         res := Complex(re +,im +
      - C: ?Complex -> res:  ?Complex:
         res := Complex(re +,im +


The Complex module has a local pattern Complex with two arguments, re and im.

Complex is declared as an immutable object - all subpatterns of Value are immutable. An immutable object cannot change state after it has been generated.

Complex has three local patterns, +, - and display. As can be seen binary patterns may be described in a style similar to Smalltalk.

+ and - have an argument C and returns a Complex object - described by '-> res: ?Complex'.

The module object below includes the Complex module and creates a number of instances of Complex and execute patterns of these objects.

ComplexEx: =
   %include LIB.Complex
   C1: =Complex(97,98)   -- a constant reference to Complex(97,98)
   C2: =Complex(2,2)  
   C3: ?Complex          -- a variable reference to Complex objects
   C3 := C1 + C2         -- the + pattern of C1 is invoked with argument C2
   C3 := C3 + Complex(2,2)
   C3 := Complex(4,4) + C3
   C3 := C3 - Complex(2,2)

Comments are started by the string '--' and terminated by end-of-line