Ada Reference Manual (Ada 2022) — Legal Information

# E.2.2 Remote Types Library Units

1
A remote types library unit supports the definition of types intended for use in communication between active partitions.
Paragraphs 2 and 3 were moved to Annex J, “Obsolescent Features”.

#### Legality Rules

4/5
When the library unit aspect (see 13.1.1) Remote_Types of a library unit is True, the library unit is a remote types library unit. The following restrictions apply to such a library unit:
5
it shall be preelaborable;
6/3
it shall depend semantically only on declared pure library_items, shared passive library units, other remote types library units, or preelaborated normal library units that are mentioned only in private with clauses;
7
it shall not contain the declaration of any variable within the visible part of the library unit;
8/2
the full view of each type declared in the visible part of the library unit that has any available stream attributes shall support external streaming (see 13.13.2).
9/3
A named access type declared in the visible part of a remote types or remote call interface library unit is called a remote access type. Such a type shall be:
9.1/1
an access-to-subprogram type, or
9.2/3
a general access type that designates a class-wide limited private type, a class-wide limited interface type, or a class-wide private extension all of whose ancestors are either private extensions, limited interface types, or limited private types.
9.3/1
A type that is derived from a remote access type is also a remote access type.
9.4/5
A remote access-to-subprogram type shall not be nonblocking (see 9.5).
10
The following restrictions apply to the use of a remote access-to-subprogram type:
11/2
A value of a remote access-to-subprogram type shall be converted only to or from another (subtype-conformant) remote access-to-subprogram type;
12
The prefix of an Access attribute_reference that yields a value of a remote access-to-subprogram type shall statically denote a (subtype-conformant) remote subprogram.
13
The following restrictions apply to the use of a remote access-to-class-wide type:
14/3
The primitive subprograms of the corresponding specific type shall only have access parameters if they are controlling formal parameters. The primitive functions of the corresponding specific type shall only have an access result if it is a controlling access result. Each noncontrolling formal parameter and noncontrolling result type shall support external streaming (see 13.13.2);
14.1/3
The corresponding specific type shall not have a primitive procedure with the Synchronization aspect specified unless the synchronization_kind is Optional (see 9.5);
15
A value of a remote access-to-class-wide type shall be explicitly converted only to another remote access-to-class-wide type;
16/4
A value of a remote access-to-class-wide type shall be dereferenced (or implicitly converted to an anonymous access type) only as part of a dispatching call to a primitive operation of the designated type where the value designates a controlling operand of the call (see E.4, “Remote Subprogram Calls”);
16.1/3
A controlling access result value for a primitive function with any controlling operands of the corresponding specific type shall either be explicitly converted to a remote access-to-class-wide type or be part of a dispatching call where the value designates a controlling operand of the call;
17/4
The Storage_Pool attribute is not defined for a remote access-to-class-wide type; the expected type for an allocator shall not be a remote access-to-class-wide type. A remote access-to-class-wide type shall not be an actual parameter for a generic formal access type. The Storage_Size attribute of a remote access-to-class-wide type yields 0. The Storage_Pool and Storage_Size aspects shall not be specified for a remote access-to-class-wide type.

#### Erroneous Execution

17.1/4
Execution is erroneous if some operation (other than the initialization or finalization of the object) modifies the value of a constant object declared in the visible part of a remote types package.
18/5
NOTE 1 A remote types library unit is not necessarily pure, and the types it defines can include levels of indirection implemented by using access types. User-specified Read and Write attributes (see 13.13.2) provide for sending values of such a type between active partitions, with Write marshalling the representation, and Read unmarshalling any levels of indirection.
19/3
NOTE 2 The value of a remote access-to-class-wide limited interface can designate an object of a nonlimited type derived from the interface.
20/5
NOTE 3 A remote access type can designate a class-wide synchronized, protected, or task interface type.

Ada 2005 and 2012 Editions sponsored in part by Ada-Europe