# Section 8.1.2.1:
ELT_NIL

###### class ELT_NIL{ETP}

#### Formal Types

types
SAME = ELT_NIL_ETP ;

This class provides a nil value for a container element and a nil test. The bit-pattern used to represent the 'nil' value is determined by the class itself if it derives from $NIL or is identically void

It should be noted that this cannot be a partial class because of the rule that a call into a partial class cannot be made from within another partial class.

#### elt_nil

This operation is provided to return a 'nil' value - one which is distinguished by not being a valid bit-pattern for representation of objects of that class.

elt_nil | : ETP

##### Formal Signature

elt_nil() res : [ETP]

##### Pre-condition

This is vacuously true since a result is always provided - even if nil!

##### Post-condition

The auxiliary function typeof is defined in Secyion 6.9.

post (res = nil) or typeof(res) in set $NIL

This routine returns a hash value for the given item, using the hash routine defined in the class of item (if one is defined), otherwise it uses the system defined hash function.

#### is_elt_nil

This predicate returns true when its argument has the value nil - which, from the definition above may be the value void (see the vdm below for the specification of this)

is_elt_nil | (
| item : ETP
| ) : BOOL

##### Formal Signature

Note that the argument type in this formal signature is an optional one - signifying in Sather terms that the argument may be void!

is_elt_nil(item : [ETP]) res : BOOL

##### Pre-condition

Since the argument to a call of this predicate may be nil then this is vacuously true.

##### Post-condition

post (res = (item = nil))
or ((typeof(item) in set $NIL)
and res = ETP.is_nil(item))

This predicate returns true if and only if either the type of item defines a nil value and item has that value or item is void.

| Language Index |  | Library Index |  | Basic Index

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