The information which is considered to be part of the interface depends upon the kind of deferred
unit. For types, the translation time property list is the entire interface (signatures are not part of
the interface for types). For other deferred units, the interface consists of both the translation time
property list (if specified) and the signature.
There are two kinds of overloading: explicit overloading and generic overloading. Explicit
overloading occurs when several distinct definitions of a name are written. Explicit overloading can be
used for any kind of deferred unit except types. Generic overloading occurs when a single deferred
declaration is replicated as a result of its appearance within a generic declaration. Generic
overloading can be used for any kind of deferred unit.
All typed languages provide a certain degree of overloading. At the very least, operations like + are
overloaded for built-in types. In languages with user-defined abstract types, some means of permitting two types to have the same operation is required.
In RED, the declaration and invocation of an overloaded routine have the same form as for a non-overloaded routine, and the selection of the invoked routine is done in a simple manner. Furthermore, selection can always be done at translation time, since it is based on type information.
Names associated with variables, constants, exceptions, goto labels, or matching identifiers cannot be
Interfaces are used to resolve each use of an overloaded name to one of the deferred units
associated with that name. Interfaces include signatures (for all deferred units except types) and
translation time property lists (if specified).
Each definition of a deferred unit has a formal interface. Each invocation of a deferred unit has an
Each use of the (possibly overloaded) name of a deferred unit is resolved to the deferred unit
associated with the name whose formal interface matches the actual interface of the use. If there is
no such deferred unit, the use is in error.
Any two definitions of a name conflict unless
- They are both deferred units of the same kind, and
- Their interfaces do not match.
The interface of a procedure, function, task, abbreviation, or capsule consists of a signature and, if
specified, the translation time property list. The interface of a capsule or type consists of a
translation time property list if any is specified.
Two interfaces match if:
- Both have matching signatures or neither includes a signature, and
- Both have matching translation time property lists or neither includes a translation time
Matching of interfaces is done during translation.
The scope rules (see Section 3.5) permit a local definition to override a conflicting definition in an
enclosing scope; that is, one deferred declaration will override another deferred declaration in an
enclosing scope if they have matching interfaces. A local declaration of one kind will override all
declarations of another kind when all share the same name.
- No signature and no translation time property list
- Signature and no translation time property list
- Translation time property list but no signature
- Both a signature and a translation time property list
A signature is part of the interface between any deferred unit except a type and its invocations.
Signatures are derived from the formal and actual parameter lists, and are not explicitly specified.
The formal signature of a procedure, function, task, abbreviation, or capsule is an ordered list of
the types or subtypes specified for its formal parameters. The list is empty if it has no formal
The actual signature of a procedure, function, task, abbreviation, or capsule invocation ls an
ordered list of the subtypes of its actual parameters. if there are no actual parameters, the list ls
Two signatures match if their lists are the same length and each of their elements match. Two
types match if they are equal (see Section 4.1.5). Two subtypes match
if they belong to the same type.
A type and a subtype match if the subtype belongs to the type.
Function result types or subtypes are not considered to be part of a signature.