A capsule declaration is invoked to make selected definitions in its body known in the scopes
where invocations of the capsule appear.
Identifier I in a capsule declaration is defined to be a capsule in the scope in which the capsule
declaration appears. Identifier 2 must be the same as identifier 1.
A capsule declaration which is invoked as old or which is a translation unit may not have any
formal parameters. A capsule may not have formal parameters of the OUT binding class.
Capsule Invocation Declaration
The capsule with name identifier 1 is invoked.
The lifetime of actual parameters passed to READONLY and VAR formal parameters must be greater
than or equal to the lifetime of the capsule invocation declaration containing those actual parameters.
A capsule invocation declaration has two effects: it causes elaboration of a capsule declaration
and it makes selected definitions visible. There are two ways in which a capsule may be invoked:
- As a new invocation (if NEW is specified).
- As an old invocation (if NEW is not specified).
Elaboration of a new capsule invocation declaration consists of
- elaborating the actual parameters;
- binding the actual parameters to the formal parameters of the invoked capsule (see Section 7.3};
- elaborating the body of the invoked capsule.
If there are any old invocations of a capsule, the body of the invoked capsule is elaborated once
upon entry to the scope in which the capsule declaration appears.
A capsule invocation declaration makes selected definitions that are locally known in the body of
the capsule also locally known in the scope where an invocation of the capsule appears (see Section
8.2). For new invocations, these definitions are the ones that have been created during elaboration of
the capsule invocation declaration. For old invocations these definitions are the ones that were
created upon entry to the scope where the capsule declaration appears.
The lifetime of any definitions made known by a new capsule invocation declaration is equal to the
lifetime of the capsule invocation declaration. The lifetime of any definitions made known by an old
capsule invocation is equal to the lifetime of the declaration of the invoked capsule.
If an invocation includes a RENAMING list, there must be a definition known as a result of the
visible list) for each identifier 2 and definable symbol 2 that appears. For each item in the list of the
name 2 TO name 3
all definitions that would be known as name 2 are known instead as name 3 in the scope where the
capsule invocation declaration appears. It name 3 is a definable symbol, all definitions of name 2 must
satisfy all restrictions upon definitions of that definable symboL
If EXTERNAL is specified, then identifier 1 must be the name of some separate translation unit. lf
EXTERNAL is not specified, a definition for identifier 1 must be known in the scope in which the
capsule invocation declaration appears.
If there are several capsule invocation declarations local to the same scope, then none of these
declarations may contain any uses of the definitions that it, or any later capsule invocation
declaration, makes known.
A capsule declaration is the only language construct to include an exports list.
A capsule declaration is a closed scope. The only definitions which are local to
a capsule declaration, as opposed to the body of
the capsule, are formal parameter definitions (see Section 3.5).
Variables declared in the capsule that are not exported act as "own" data of the capsule.
Like all data in the capsule, such
variables come into existence each time the body of the capsule is elaborated;
the statements in the capsule body may be used to
Translation time property lists are used to overload capsules and to create generic capsules.