Sather Home         Page

Section 8.10.1.6:
$OPTION

abstract class $OPTION < $INSTR
$INSTR

Inheritance map

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 ;
$OPTION = set of object_type

state

multi : $OPTION
   inv multi_types ==
      forall obj in set multi_types &
         sub_type($OPTION,obj)
NOTE See the important note about vdm state in the notes on vdm-sl usage in this specification.

This abstraction encapsulates the notion of a program option argument. An option may be of any kind for which an external textual representation is provided and suitable for reading.


create

This creation routine takes a string of text and returns a value in the class (or nil!).

create (
instr : STR
) : SAME
Formal Signature
create(self : SAME, instr : STR) res : [SAME]
Pre-condition
pre  STR.size(instr) > 0
Post-condition

If the indicated text string does not have a valid representation of an object of the sub-typing class then nil shall be returned.

post str(res) = instr
      or res = nil

This returns a new object which has been converted from the given text string. If the argument is not a valid text representation of a value of the class void is returned.

NOTE The return of void is the Sather equivalent of the vdm-sl value 'nil'. Although the situation giving rise to the nil is defined as corresponding to the inability to carry out the conversion, this is different from the vdm-sl concept of error which is more closely related to the Sather exception concept.

Language Index Library Index Input/Output Index
Comments or enquiries should be made toKeith Hopper.
Page last modified: Wednesday, 4 April 2001.
Produced with Amaya