# Examples 6.3:
Routine signatures

The most obvious places to need to use routine signatures are when defining the features of an abstract class or when defining stubs in a partial class. Stubs are discussed in section 6.6 of this specification. That section refers back to this section of the specification for signature detail.

### $LOCK Example

The abstract class $LOCK is one of the pervasive classes defined by the language (see section 7). It defines the following routine signature.

acquirable | (
| tid : $REFERENCE
| ) : BOOL

Note that the argument identifier in this signature may be freely chosen. It need not have the same name as its eventual implementation in some implementing class.

### $ATTACH Example

A routine signature without argument and without return value or with both are the only kinds which must eventually be implemented as a routine. Any single argument signature without return type could be a writer routine, while any signature with return type only could be a reader routine. Just as the above example can only be implemented as an ordinary routine, so can the following from the pervasive abstract class $ATTACH.

birth

which has neither argument nor return value.

### Reader/Writer Signatures

The $FILE_CURSORS abstract class in the Required Library defines two routines called position which from their signatures are a fairly 'obvious' reader/writer pair (were the writer routine to have no return value) -

position | : CARD

position | (
| at : CARD
| ) : SAME ;

although their eventual implementation need not be just a simple publicly visible attribute. In practice for this example, such a simple implementation would be unlikely!

Note in this last example that the return type is given as SAME. This is the one occasion that SAME is permitted in an abstract signature - as the return type.

| Specification Index |  | Language Index |  | Routine signatures |  | Section 6 Index

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