CVS difference for ais/ai-00254.txt

Differences between 1.7 and version 1.8
Log of other versions for file ais/ai-00254.txt

--- ais/ai-00254.txt	2003/11/27 02:01:13	1.7
+++ ais/ai-00254.txt	2004/01/23 04:59:24	1.8
@@ -1,5 +1,15 @@
-!standard 03.10   (11)                               03-11-11  AI95-00254/05
+!standard  3.10   (06)                               04-01-13  AI95-00254/06
+!standard  3.10   (12)
+!standard  3.7    (09)
+!standard  3.10.2 (13)
+!standard  4.9.1  (02)
+!standard  6.1    (24)
+!standard  6.1    (27)
+!standard  8.5.1  (03)
+!standard  8.5.1  (04)
 !class amendment 00-12-06
+!status Amendment 200Y 04-01-13
+!status ARG Approved 11-0-2  03-12-12
 !status work item 02-11-06
 !status ARG Approved 5-0-2  02-02-11
 !status work item 01-08-29
@@ -27,14 +37,14 @@
 
 Furthermore, experience with anonymous access-to-object types has shown that
 they are not as flexible as might have been desired and it is thus proposed
-that they by permitted in more contexts as described in AI-230 and with
+that they be permitted in more contexts as described in AI-230 and with
 further control over whether they have a null value in AI-231. Similar
 flexibility is hereby proposed for anonymous access-to-subprogram types.
 
 !proposal
 
 NOTE: this AI assumes that AI-230 and AI-231 are approved. It is based on
-AI-230/07 and AI-231/05. Changes may be required if these AIs are modified.
+AI-230/09 and AI-231/07. Changes may be required if these AIs are modified.
 
 The key change is that the syntactic form access_definition which currently
 is used solely for anonymous access-to-object types is extended to include
@@ -42,8 +52,8 @@
 
    access_definition ::=
       [null_exclusion] access [general_access_modifier] subtype mark |
-      [null_exclusion] access procedure parameter_profile |
-      [null exclusion] access function parameter_and_result_profile
+      [null_exclusion] access [protected] procedure parameter_profile |
+      [null exclusion] access [protected] function parameter_and_result_profile
 
 Recall that AI-230 permits access_definition in contexts other than as formal
 parameters. We will first consider the use of anonymous access-to-subprogram
@@ -88,13 +98,10 @@
 
 Default parameters are permitted for access-to-subprogram parameters with
 the usual semantics for parameters of mode in.
-
-The option of being protected does not apply to access-to-subprogram
-parameters. An access to a protected operation may not be passed to such
-parameters.
 
-The convention of an access-to-subprogram parameter is the convention of the
-subprogram that contains the parameter.
+The convention of an access-to-subprogram parameter is protected if the
+access definition includes the word protected and otherwise is the convention
+of the subprogram that contains the parameter.
 
 Anonymous access-to-subprogram types may also be used in other contexts by
 analogy with access-to-object types and in particular as extended by AI-230.
@@ -116,9 +123,9 @@
       CP: access function(F: Float) return Float;
    end record;
 
-A_Record: R := (Sqrt'Access);
+A_Record: R := (CP => Sqrt'Access);
 
-type A is array(Integer range <>) of access function(F: Float)return Float;
+type A is array (Integer range <>) of access function(F: Float)return Float;
 
 An_Array: A := (Sqrt'Access, Sin'Access, Log'Access,...);
 
@@ -127,15 +134,28 @@
 In all these situations subtype conformance is required.
 
 !wording
+
+This assumes the wording as already modified by AI-230/09 and AI-231/07.
+
+Replace 3.7(9) by
 
-This assumes the wording as already modified by AI-230/07 and AI-231/05.
+The subtype of a discriminant may be defined by an optional null_exclusion and
+a subtype_mark, in which case the subtype_mark shall denote a discrete or
+access subtype, or it may be defined by an access definition. A discriminant
+that is defined by an access_definition is called an access discriminant and
+is either of an anonymous access-to-object type whose designated subtype is
+denoted by the subtype_mark of the access_definition or is of an anonymous
+access-to-subprogram type whose designated profile is denoted by the
+parameter_profile or parameter_and_result_profile of the access_definition.
 
 Replace 3.10(6) by
 
+   null_exclusion ::= not null
+
    access_definition ::=
       [null_exclusion] access [general_access_modifier] subtype mark |
-      [null_exclusion] access procedure parameter_profile |
-      [null exclusion] access function parameter_and_result_profile
+      [null_exclusion] access [protected] procedure parameter_profile |
+      [null_exclusion] access [protected] function parameter_and_result_profile
 
 Replace 3.10(12) by
 
@@ -147,13 +167,9 @@
 parameter_profile or parameter_and_result_profile denotes its designated
 profile.
 
-If a null_exclusion is present, or the
-access_definition is for a controlling access parameter (see 3.9.2), the
-access_definition defines an access subtype which excludes the null value;
-otherwise the subtype includes 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). [NOTE: Modify as finally decided by AI-230 either
-to delete the last sentence or add renaming and components.]
+If a null_exclusion is present, or the access_definition is for a controlling
+access parameter (see 3.9.2), the access_definition defines an access subtype
+which excludes the null value; otherwise the subtype includes a null value.
 
 Replace 3.10.2(13) by
 
@@ -164,9 +180,13 @@
 
 *   The accessibility level of the anonymous access type of an access parameter
     specifying an access-to-subprogram type is infinite.
+
+Replace 4.9.1(2) by
 
-[NOTE: I don't think anything else in this section needs changing. In
-particular, 3.10.2(32) seems OK still.]
+A subtype statically matches another subtype of the same type if they have
+statically matching components. Two anonymous access subtypes statically
+match if their designated subtypes statically match or their designated
+profiles are subtype conformant.
 
 Replace 6.1(24) by
 
@@ -188,15 +208,39 @@
 Add after 6.3.1(13)
 
 *   The calling convention for an access parameter of an access-to-subprogram
-    type is the convention of the subprogram that contains the parameter.
-
-[NOTE: 6.4.1(6) says
+    type is protected if the reserved word protected appears in its definition
+    and otherwise is the convention of the subprogram that contains the
+    parameter.
+
+Replace 8.5.1(3) by
+
+The type of the object_name shall resolve to the type determined by the
+subtype_mark, or in the case where the type is defined by an access
+definition, to a specific anonymous access type which in the case of an
+access-to-object type shall have the same designated type as that of the
+access definition and in the case of an access-to-subprogram type shall have
+a designated profile which is subtype conformant with that of the access
+definition.
+
+[NOTE should that be designated subtype in the above? I copied it from 230/09.]
+
+Replace 8.5.1(4) by
+
+The renamed entity shall be an object. In the case of a renaming with an
+access definition of an access-to-object type, then the access definition
+shall be of an access-to-constant type if and only if the renamed object is
+of an access-to-constant type.
+
+[NOTE This is the wording to be expected from 230/231 and is written out
+here just to clarify that the second sentence does not apply to
+access-to-subprogram types.]
+
+[NOTE I assume that we don't have to say that the accessiblity level is the
+same as that of the renamed object because accessibility is just one of the
+"properties" covered by 8.5.1(6). Its covered by 3.10.2(8) anyway.]
 
-The type of the actual parameter associated with an access parameter shall be
-convertible (see 4.6) to its anonymous access type.
+[NOTE does 8.6(25) need changing?]
 
-This seems to cover both cases and so doesn't need changing.]
-
 !discussion
 
 There are two basic uses for what might loosely be called pointers to
@@ -706,7 +750,7 @@
 to pass any auxiliary data such as the nonlocal variable X.
 
 with Integrate;
-ppackage P is
+package P is
 
    type F_Integrator is new Integrate.Integrator with
       record
@@ -830,8 +874,163 @@
 subprogram parameters.
 
 
+!corrigendum 3.7(9)
+
+@drepl
+The subtype of a discriminant may be defined by a @fa<subtype_mark>, in which
+case the @fa<subtype_mark> shall denote a discrete or access subtype, or it may
+be defined by an @fa<access_definition> (in which case the @fa<subtype_mark> of
+the @fa<access_definition> may denote any kind of subtype). A discriminant that
+is defined by an @fa<access_definition> is called an @i<access discriminant> and is
+of an anonymous general access-to-variable type whose designated subtype is
+denoted by the @fa<subtype_mark> of the @fa<access_definition>.
+@dby
+The subtype of a discriminant may be defined by an optional @fa<null_exclusion>
+and a @fa<subtype_mark>, in which case the @fa<subtype_mark> shall denote a
+discrete or access subtype, or it may be defined by an @fa<access_definition>.
+A discriminant that is defined by an @fa<access_definition>
+is called an @i<access discriminant> and is either of an anonymous
+access-to-object type whose designated subtype is
+denoted by the @fa<subtype_mark> of the @fa<access_definition> or is of an
+anonymous access-to-subprogram type whose designated profile is denoted by the
+@fa<parameter_profile> or @fa<parameter_and_result_profile> of the
+@fa<access_definition>.
+
+!corrigendum 3.10(6)
+
+@drepl
+@xcode<@fa<access_definition ::= >@ft<@b<access>>@fa< subtype_mark>>
+@dby
+@xcode<@fa<null_exclusion ::= >@ft<@b<not null>>
+@fa<access_definition ::=
+   [null_exclusion] >@ft<@b<access>>@fa< [general_access_modifier] subtype_mark |
+   [null_exclusion] >@ft<@b<access>>@fa< [>@ft<@b<protected>>@fa<] >@ft<@b<procedure>>@fa< parameter_profile |
+   [null_exclusion] >@ft<@b<access>>@fa< [>@ft<@b<protected>>@fa<] >@ft<@b<function>>@fa< parameter_and_result_profile>>
+
+!corrigendum 3.10(12)
+
+@drepl
+An @fa<access_definition> defines an anonymous general access-to-variable type;
+the @fa<subtype_mark> denotes its @i<designated subtype>. An
+@fa<access_definition> is used in the specification of an access discriminant
+(see 3.7) or an access parameter (see 6.1).
+@dby
+An @fa<access_definition> defines an anonymous general access type or an
+anonymous access-to-subprogram type. For a general access type, the
+@fa<subtype_mark> denotes its @i<designated subtype>; if the reserved word
+@b<constant> appears, the type is an access-to-constant type; otherwise it is
+an access-to-variable type. For an access-to-subprogram type, the
+@fa<parameter_profile> or @fa<parameter_and_result_profile> denotes its
+designated profile. If a @fa<null_exclusion> is present, or the
+@fa<access_definition> is for a controlling access parameter (see 3.9.2), the
+@fa<access_definition> defines an access subtype which excludes the null value;
+otherwise the subtype includes a null value.
+
+!corrigendum 3.10.2(13)
+
+@drepl
+@xbullet<The accessibility level of the anonymous access type of an access
+parameter is the same as that of the view designated by the actual. If the
+actual is an @fa<allocator>, this is the accessibility level of the execution
+of the called subprogram.>
+@dby
+@xbullet<The accessibility level of the anonymous access type of an access
+parameter specifying an access-to-object type is the same as that of the view
+designated by the actual. If the actual is an @fa<allocator>, this is the
+accessibility level of the execution of the called subprogram.>
+@xbullet<The accessibility level of the anonymous access type of an access
+parameter specifying an access-to-subprogram type is infinite.>
+
+!corrigendum 4.9.1(2)
+
+@drepl
+A subtype @i<statically matches> another subtype of the same type if they have
+statically matching constraints. Two anonymous access subtypes statically match
+if their designated subtypes statically match.
+@dby
+A subtype @i<statically matches> another subtype of the same type if they have
+statically matching constraints. Two anonymous access subtypes statically
+match if their designated subtypes statically match or their designated
+profiles are subtype conformant.
+
+!corrigendum 6.1(24)
+
+@drepl
+An @i<access parameter> is a formal @b<in> parameter specified by an
+@fa<access_definition>. An access parameter is of an anonymous general
+access-to-variable type (see 3.10). Access parameters allow dispatching calls
+to be controlled by access values.
+@dby
+An @i<access parameter> is a formal @b<in> parameter specified by an
+@fa<access_definition>. An access parameter is of an anonymous general
+access-to-object type or an anonymous access-to-subprogram type (see 3.10).
+Access parameters of an access-to-object type allow dispatching calls to be
+controlled by access values. Access parameters of an access-to-subprogram type
+permit calls to subprograms passed as parameters irrespective of their
+accessibility level.
+
+!corrigendum 6.1(27)
+
+@drepl
+@xbullet<For any access parameters, the designated subtype of the parameter
+type.>
+@dby
+@xbullet<For any access parameters of an access-to-object type, the designated
+subtype of the parameter type.>
+@xbullet<For access parameters of an access-to-subprogram type, the subtypes of
+the profile of the parameter type.>
+
+!corrigendum 6.3.1(13)
+
+@dinsa
+@xbullet<The default calling convention is @i<entry> for an entry.>
+@dinst
+@xbullet<The calling convention for an access parameter of an
+access-to-subprogram type is @i<protected> if the reserved word @b<protected>
+appears in its definition and otherwise is the convention of the subprogram
+that contains the parameter.>
+
+!corrigendum 8.5.1(3)
+
+@drepl
+The type of the @fa<object_name> shall resolve to the type determined by the
+@fa<subtype_mark>.
+@dby
+The type of the @fa<object_name> shall resolve to the type determined by the
+@fa<subtype_mark>, or in the case where the type is defined by an
+@fa<access_definition>, to a specific anonymous access type which in the case
+of an access-to-object type shall have the same designated type as that of the
+@fa<access_definition> and in the case of an access-to-subprogram type shall
+have a designated profile which is subtype conformant with that of the
+@fa<access_definition>.
+
+!corrigendum 8.5.1(4)
+
+@drepl
+The renamed entity shall be an object.
+@dby
+The renamed entity shall be an object.
+In the case where the type is defined by an @fa<access_definition> of an
+access-to-object type, the renamed entity shall be of an access-to-constant
+type if and only if the @fa<access_definition> defines an access-to-constant
+type.
+
+!corrigendum 8.6(25)
+
+@dinsa
+@xinbull<when @i<T> is an anonymous access type (see 3.10) with designated
+type @i<D>, to an access-to-variable type whose designated type is @i<D>'Class
+or is covered by @i<D>.>
+@dinst
+@xinbull<when @i<T> is an anonymous access-to-subprogram type (see 3.10), to
+an access-to-subprogram type whose designated profile is subtype-conformant
+with @i<T>'s designated profile.>
+
+
 !ACATS test
 
+ACATS tests need to be constructed to test this feature.
+
 !appendix
 
 From: Robert A Duff
@@ -863,7 +1062,7 @@
 !reference RM9X-3.10.2(16);4.0
 !reference AARM-12.3(12.p,12.q);4.0
 !reference LSN-1042 on Accessibility Checks in Generics
-!from Bob Duff $Date: 2003/11/27 02:01:13 $ $Revision: 1.7 $
+!from Bob Duff $Date: 2004/01/23 04:59:24 $ $Revision: 1.8 $
 !discussion
 
 Two issues related to access types and the accessibility rules came
@@ -1276,7 +1475,7 @@
 !topic LSN on Accessibility Checks in Generics
 !key LSN-1042 on Accessibility Checks in Generics
 !reference MS-12;4.6
-!from Bob Duff $Date: 2003/11/27 02:01:13 $ $Revision: 1.7 $
+!from Bob Duff $Date: 2004/01/23 04:59:24 $ $Revision: 1.8 $
 !discussion
 
 This Language Study Note discusses accessibility checks, and their
@@ -3146,6 +3345,15 @@
 
 I am a little surprised that this particular problem was not trivially
 solved using a generic procedure.
+
+****************************************************************
+
+From: Javier Miranda
+Sent: Thursday, December 18, 2003  4:37 AM
+
+There is a typo at line 30:
+
+that they by permitted in more contexts as described in AI-230 and with
 
 ****************************************************************
 

Questions? Ask the ACAA Technical Agent