string is a parameterless procedure delivering an object of type
STRING representing the current value of an object. In case of
simple value types the string is a denotation. Otherwise it has the
form of an aggregate
listing all the attributes
which have simple values whereas the values of attributes of a
reference type are replaced by a hash sign #. string may be
redefined to provide more appropriate representations.
This procedure returns true, if the arguments is the same as self. That means identity for reference objects and same value for value objects. If the argument and self are of different type, is_equal returns false.
Every class type defines a constant type : TYPE with a value which is different for each class type. For an object a a string representation of its type may be obtained by a.type.str.
This procedure delivers a new object of the same type containing copies of the values of all attributes of the current object. The type must be a reference type.
If defined, the init method is called during object creation, before attributes defined by initialized declarations receive their initial values. Init must not be called explicitely. If an invariant method is supplied, this is not checked right after the call to init, but when all initializations are processed.
This procedure is called before an object is destructed. This will happen on return from methods for local value objects or when the garbage collector removes an object.
If the programmer supplies such a procedure in a class then it is supposed to define the class invariant. If the call returns the result false then the exception INVARIANT_ERROR is raised.
The class OB defines a stream method
stream until(b: BOOL) is loop if b then return; end; resume; end; end;
which may be used to define loops that are executed at least once.
Example: The typical usage of until is
loop ... until!(all_done); end;
The parameter b of until is not declared once. So b is
reevaluated for every stream call and not only for the first call.
The classes INT, SHORT_INT, LONG_INT, UNSIGNED, SHORT_UNSIGNED, LONG_UNSIGNED and INTINF define streams
stream upto(!to:SAME):SAME is res := self; loop if res > to then return; end; resume; res := res + 1; end; end;
stream downto(!to: SAME): SAME is res := self; loop if res < to then return; end; resume; res := res - 1; end; end;
that may be used for for-loops.
Example: Its typical usage is
loop 1.upto!(i); ... end;
The parameter to of upto is declared once. So to is only
evauated once for the first call. Later changes of i will not affect
the number of iterations.