CVS difference for ais/ai-00231.txt

Differences between 1.1 and version 1.2
Log of other versions for file ais/ai-00231.txt

--- ais/ai-00231.txt	2000/04/14 03:39:48	1.1
+++ ais/ai-00231.txt	2001/10/02 01:27:51	1.2
@@ -1,4 +1,4 @@
-!standard  3.10      (06)                        00-04-13  AI95-00231/01
+!standard  3.10      (06)                        01-10-01  AI95-00231/02
 !standard  3.10      (12)
 !standard  4.6       (49)
 !standard  8.6       (25)
@@ -7,13 +7,14 @@
 !status received 00-04-13
 !priority Medium
 !difficulty Hard
-!subject Access-to-constant parameters
+!subject Access-to-constant parameters and null-excluding subtypes
 
 !summary
 
 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.
+to have a variant that allows a null value. Null-excluding subtypes of
+a named access type are introduced.
 
 !problem
 
@@ -21,22 +22,59 @@
 
 !proposal
 
+Introduce a not-null constraint, and an access_constraint syntactic category.
+
+Modify 3.2.2(5) to:
+    constraint ::= scalar_constraint | access_constraint | composite_constraint
+
+    access_constraint ::=
+       not_null_constraint | composite_constraint [not_null_constraint]
+
 Modify 3.10(6) to:
 
-    access_definition ::= ACCESS [ALL | CONSTANT] subtype_mark
+    not_null_constraint ::= NOT NULL
 
-Modify 3.10(12) to:
+    access_definition ::=
+       ACCESS ALL subtype_mark [not_null_constraint]
+     | ACCESS CONSTANT subtype_mark [not_null_constraint]
+     | ACCESS subtype_mark
 
-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 3.10(12) to:
 
-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.)
+    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 the words @b<not null> appear, the
+    access_definition defines an access subtype which excludes the null
+    value. If neither @b<all> nor @b<constant> appear, the access definition is
+    equivalent to having both @b<all> and @b<not null> present, and hence
+    defines an access-to-variable subtype that excludes the null value. An
+    access_definition is used in the specification of an access discriminant
+    (see 3.7) or an access parameter (see 6.1).
+
+Drop the parenthetical "(named)" from the first sentence of 3.10(13), since in
+our new model, anonymous access types have a null value, even though a subtype
+might exclude the null value.
+
+Modify 3.10(15), to:
+    An access_constraint includes a not_null_constraint, a
+    composite_constraint, or both. An access_constraint with a
+    composite_constraint is compatible with an unconstrained access subtype if
+    the composite_constraint is compatible with the designated subtype. An
+    access_constraint with a not_null_constraint is compatible with an access
+    subtype if the subtype includes a null value. An access value satisfies a
+    composite_constraint imposed on an access subtype if it equals the null
+    value of its type or if it designates an object whose value satisfies the
+    constraint.  An access value satisifes a not_null_constraint imposed on an
+    access subtype if it does not equal the null value of its type.
+
+Delete paragraph 4.1.4(7) which says that anonymous access types don't
+have a null value.
+
+Modify 4.6(49) to:
+    If the target subtype excludes the null value, then a check is made that
+    the value of the operand is not null; if the target subtype includes null,
+    then the result of the conversion is null if the operand value is null.
 
 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
@@ -63,13 +101,22 @@
    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.
+turned out to be confusing, and not what is wanted in all cases when
+interfacing with a foreign language. Therefore, we propose to define an
+explicit way to exclude nulls from an access subtype, make "access all T" and
+"access constant T" includes nulls by default, but for backward compatibility
+make "access T" a shorthand for "access all T not null."
+
+The general ability to specify an access subtype that excludes null for both
+named and anonymous access types can provide useful documentation and higher
+efficiency. This is especially true for parameters, by allowing the nullness
+check to be "pushed" to the caller, where it can be more likely removed.
+
+What should be the default initialization of an object of a subtype that
+excludes null? It seems clear that the default is still null, and the
+initialization will raise Constraint_Error. Hence, objects of such a subtype
+will require explicit initialization. Perhaps a NOTE to this effect should be
+included in 3.10.
 
 !appendix
 

Questions? Ask the ACAA Technical Agent