Objects and Values

Data processed by a Refal Plus program may be either objects or values.

"Object" is usually understood to mean an entity that exists in time and may vary, but, nevertheless, does not lose its identity.

"Value" is usually understood to mean an entity that is unable to vary and, in a sense, exists out of time.

A value may, certainly, be regarded as a special, degenerate, case of object (i.e. as a rigid object unable to develop). Nevertheless, the term "object" will be usually applied only to "proper" objects, which are not values.

Since objects may vary, they are more difficult to deal with than values are. Thus objects are often provided with names. The basic property of names is that a name is unambiguously associated with an object (i.e. a name unambiguously identifies the object). In contrast to objects, their names are typical values, there being no changes in the names in spite of there being drastic changes in the objects.

Programs in Refal Plus deal with both objects and values.

All values manipulated by Refal programs are ground expressions, which are finite sequences of symbols and parentheses, the parentheses being properly paired. Parentheses are used for giving a tree structure to ground expressions, whereas symbols represent basic data, such as characters, numbers, words, and references to objects.

Objects dealt with by a Refal program may contain ground expressions, which, in turn, may contain references to objects. The contents of objects may be modified by the Refal program, in which case the objects are accessed through their names, reference symbols.

Objects may be created at compile time as well as at run time. Theoretically, having been created, an object exists eternally. In practice, however, Refal programs are to be run by computers with limited memory capacity, thus all Refal implementations must include a garbage collector, whose purpose is to automatically destroy objects inaccessible to the program, and, thus, unable to influence the program's behavior.