Version 1.1 of ais/ai-00231.txt
!standard 3.10 (06) 00-04-13 AI95-00231/01
!standard 3.10 (12)
!standard 4.6 (49)
!standard 8.6 (25)
!class amendment 00-04-13
!status work item 00-04-13
!status received 00-04-13
!subject Access-to-constant parameters
Parameters and discriminants of an anonymous access-to-constant type are
introduced. Access parameters and access discriminants are generalized
to have a variant that allows a null value.
Modify 3.10(6) to:
access_definition ::= access [all | constant] subtype_mark
Modify 3.10(12) to:
An access_definition defines an anonymous general access type; the subtype
mark denotes its @i<designated subtype>. If the word @b<all> appears, the
type is an access-to-variable type. If the word @b<constant> appears, the
type is an access-to-constant type. If neither word appears, the type is an
access-to-variable type that does not include a null value. An
access_definition is used in the specification of an access discriminant
(see 3.7) or an access parameter (see 6.1).
Modify 4.6(49) so that the null check is performed only if neither @b<all> or
@b<constant> are given. (Editor's note: We really need a name for such types.)
Modify 8.6(25) so that implicit conversion to any anonymous access type is
permitted, with the expected rules (i.e. it is illegal to convert an
access-to-constant to access-to-variable).
It is surprising that an access-to-constant parameter/discriminant is
not available. There are several circumstances where such a
parameter/discriminant would be appropriate:
As a controlling parameter of an operation that doesn't modify the
As a way to force pass-by-reference when interfacing with a foreign
language, when the external operation does not update the designated
As a way to provide read-only access via a discriminant.
The rule disallowing "null" for access parameters and access discriminants has
turned out to be confusing, and not really what is wanted typically when
interfacing with a foreign language. Therefore, we propose to include the
"access all T" as a way to pass a potentially-null pointer which might point
to a local object. The new "access constant T" parameters/discriminants also
allow null values, to avoid the confusion that occurred with "access T." Also,
there is less need for a never-null access-to-constant since a normal "IN"
parameter works quite well for that case.
Randy Brukardt 00-04-13
This proposal was split out of the "with type" proposal (AI-00217) in
April 2000. Some early conversation on this feature can be found in that
Questions? Ask the ACAA Technical Agent