Types of Data Classes
Four types of data classes are distinguished:
- Native classes: data classes with methods that are directly (natively) provided by the simulator.
- Permanent classes: native classes that must be part of any POOSL model, because they are used in native methods of primitive classes (see below). Permanent classes do not have instance variables. For example, class Object cannot have instance variables, because they would be inherited by primitive classes, which is not possible. Subclasses of permanent classes can be defined by the user to create extensions with instance variables. Class String is a permanent class that has syntactic representations of its instances (see below).
- Primitive classes: permanent classes with a fixed (possibly infinite) collection of instances, that have syntactic representations of their instances and whose behavior is defined in the formal semantics of the language. Primitive classes cannot have subclasses. Instances of primitive classes are called primitive objects. Primitive objects do not have state, in particular they have no references to other objects.
- User-defined class: non-native classes.
User-defined methods can be added for any data class, while user-defined instance variables are not allowed for permanent classes. Subclasses are not allowed for primitive classes. Instances of data classes can be created using new, except in case of primitive classes. For primitive classes and Strings, the syntactic representation allows identifying, respectively creating new instances.
A type C associated with data class C consists of the constant nil and all instances of data class C and all its subclasses.