Annotated Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

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.]

Language Design Principles

1.a
The restrictions governing a remote types package are similar to those for a declared pure package. However, the restrictions are relaxed deliberately to allow such a package to contain declarations that violate the stateless property of pure packages, though it is presumed that any state-dependent properties are essentially invisible outside the package. 

Syntax

2
{categorization pragma (Remote_Types) [partial]} {pragma, categorization (Remote_Types) [partial]} The form of a pragma Remote_Types is as follows: 
3
  pragma Remote_Types[(library_unit_name)];

Legality Rules

4
{remote types library unit} A remote types library unit is a library unit to which the pragma Remote_Types applies. The following restrictions apply to the declaration of such a library unit: 
5
[it shall be preelaborable;]
6
it shall depend semantically only on declared pure, shared passive, or other remote types library units;
7
it shall not contain the declaration of any variable within the visible part of the library unit; 
7.a
Reason: This is essentially a “methodological” restriction. A separate copy of a remote types package is included in each partition that references it, just like a normal package. Nevertheless, a remote types package is thought of as an “essentially pure” package for defining types to be used for interpartition communication, and it could be misleading to declare visible objects when no remote data access is actually being provided. 
8/2
{AI95-00240-01} {AI95-00366-01} 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). 
8.a
Reason: This is to prevent the use of the predefined Read and Write attributes of an access type as part of the Read and Write attributes of a visible type. 
8.b/2
Ramification: {AI95-00366-01} Types that do not have available stream attributes are excluded from this rule; that means that attributes do not need to be specified for most limited types. It is only necessary to specify attributes for nonlimited types that have a part that is of any access type, and for extensions of limited types with available stream attributes where the record_extension_part includes a subcomponent of an access type, where the access type does not have specified attributes. 
9/1
{8652/0082} {AI95-00164-01} {remote access type} An access type declared in the visible part of a remote types or remote call interface library unit is called a remote access type. {remote access-to-subprogram type} {remote access-to-class-wide type} Such a type shall be:
9.1/1
{8652/0082} {AI95-00164-01} an access-to-subprogram type, or
9.2/1
{8652/0082} {AI95-00164-01} a general access type that designates a class-wide limited private type or a class-wide private type extension all of whose ancestors are either private type extensions or limited private types. 
9.3/1
 {8652/0081} {AI95-00004-01} A type that is derived from a remote access type is also a remote access type.
10
The following restrictions apply to the use of a remote access-to-subprogram type: 
11/2
{AI95-00431-01} 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/2
{8652/0083} {AI95-00047-01} {AI95-00240-01} {AI95-00366-01} The primitive subprograms of the corresponding specific limited private type shall only have access parameters if they are controlling formal parameters; each non-controlling formal parameter shall support external streaming (see 13.13.2);
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/1
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 where the value designates a controlling operand of the call (see E.4, “Remote Subprogram Calls”).
17/2
{AI95-00366-01} 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; it is not allowed in an attribute_definition_clause.
17.a/2
Reason: All three of these restrictions are because there is no storage pool associated with a remote access-to-class-wide type. The Storage_Size is defined to be 0 so that there is no conflict with the rules for pure units. 
NOTES
18
5  A remote types library unit need not be pure, and the types it defines may 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. 

Incompatibilities With Ada 95

18.a/2
{AI95-00240-01} {incompatibilities with Ada 95} Amendment Correction: The wording was changed from “user-specified” to “available” attributes. (This was then further changed, see below.) This means that an access type with the attributes specified in the private part would originally have been sufficient to allow the access type to be used in a remote type, but that is no longer allowed. Similarly, the attributes of a remote type that has access components have to be specified in the visible part. These changes were made so that the rules were consistent with the rules introduced for the Corrigendum for stream attributes; moreover, legality should not depend on the contents of the private part. 

Extensions to Ada 95

18.b/2
{AI95-00366-01} {extensions to Ada 95} Remote types that cannot be streamed (that is, have no available stream attributes) do not require the specification of stream attributes. This is necessary so that most extensions of Limited_Controlled do not need stream attributes defined (otherwise there would be a signficant incompatibility, as Limited_Controlled would need stream attributes, and then all extensions of it also would need stream attributes). 

Wording Changes from Ada 95

18.c/2
{8652/0081} {AI95-00004-01} Corrigendum: Added missing wording so that a type derived from a remote access type is also a remote access type.
18.d/2
{8652/0083} {AI95-00047-01} Corrigendum: Clarified that user-defined Read and Write attributes are required for the primitive subprograms corresponding to a remote access-to-class-wide type.
18.e/2
{8652/0082} {AI95-00164-01} Corrigendum: Added missing wording so that a remote access type can designate an appropriate private extension.
18.f/2
{AI95-00366-01} Changed the wording to use the newly defined term type that supports external streaming, so that various issues with access types in pure units and implicitly declared attributes for type extensions are properly handled.
18.g/2
{AI95-00366-01} Defined Storage_Size to be 0 for remote access-to-class-wide types, rather than having it undefined. This eliminates issues with pure units requiring a defined storage size.
18.h/2
{AI95-00431-01} Corrected the wording so that a value of a local access-to-subprogram type cannot be converted to a remote access-to-subprogram type, as intended (and required by the ACATS). 

Contents   Index   References   Search   Previous   Next 
Ada-Europe Sponsored by Ada-Europe