VDM-10 Language Manual
VDM-10 Language Manual
VDM-10 Language Manual
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Chapter 14. Top-level Specification (<strong>VDM</strong>++ and <strong>VDM</strong>-RT)<br />
| instance variable definitions<br />
| synchronization definitions<br />
| thread definitions ;<br />
Semantics: Each class description has the following parts:<br />
• A class header with the class name and an optional inheritance clause.<br />
• An optional class body.<br />
• A class tail.<br />
The class name as given in the class header is the defining occurrence of the name of the<br />
class. A class name is globally visible, i.e. visible in all other classes in the specification.<br />
The class name in the class header must be the same as the class name in the class tail.<br />
Furthermore, defining class names must be unique throughout the specification.<br />
The (optional) class body may consist of:<br />
• A set of value definitions (constants).<br />
• A set of type definitions.<br />
• A set of function definitions.<br />
• A set of instance variable definitions describing the internal state of an object instantiated<br />
from the class. State invariant expressions are encouraged but are not mandatory.<br />
• A set of operation definitions that can act on the internal state.<br />
• A set of the synchronization definitions, specified either in terms of permission predicates<br />
or using mutex constraints.<br />
• A set of thread definitions that describe the thread of control for active objects.<br />
• A set of traces that are used to indicate the sequences of operation calls for which test<br />
cases are desired to be produced automatically.<br />
In general, all constructs defined within a class must have a unique name, e.g. it is not allowed<br />
to define an operation and a type with the same name. However, it is possible to overload<br />
function and operation names (i.e. it is possible to have two or more functions with the same<br />
name and two or more operations with the same name) subject to the restriction that the<br />
types of their input parameters should not overlap. That is, it should be possible using static<br />
type checking alone to determine uniquely and unambiguously which function/operation<br />
definition corresponds to each function/operation call. Note that this applies not only to<br />
functions and operations defined in the local interface of a class but also to those inherited<br />
from superclasses. Thus, for example, in a design involving multiple inheritance a class C<br />
may inherit a function from a class A and a function with the same name from a class B and<br />
all calls involving this function name must be resolvable in class C.<br />
129