| # Section 8.1.1.10: $VAR |

###### abstract class $VAR

#### Formal Definitions

This abstract class defines a state component which is a set of all instantiations of objects of any class sub-typing from this class in addition to the vdm model types used wherever this class name is used. Note that SAME has to be an instantiated class, not an abstract one.

types
SAME = object_type ;
$VAR = set of object_type
state
multi : $VAR
inv multi_types ==
forall obj in set multi_types & sub_type($VAR,obj)

NOTE | See the important note about vdm state in the notes on vdm-sl usage in this specification.

This abstract class defines the concept of a reference class having immutable semantics. This is provided by the single feature defined below.

#### as_value

This feature requires a sub-typing class to implement this facility of returning an object as a new value. This means that there shall be no references to reference components of self in the object returned.

as_value | $OB

##### Formal Signature

as_value(self : SAME) res : SAME

##### Pre-condition

Note that in contrast to a pre-condition written in Sather source code, in vdm-sl the type SAME is not an optional type and therefore self must exist, leading to the vacuous pre-condition.

##### Post-condition

This post-condition equality is equality of value in the sense defined for vdm. It is not object equality.

post res = self

This feature returns the value of all components of self (rexursively) in a new object. No reference objects in the result refer to reference objects in self!

| Language Index |  | Library Index |  | Basic Index

Comments or enquiries should be made to Keith Hopper. Page last modified: Wednesday, 24 May 2000. |