CVS difference for ai05s/ai05-0158-1.txt

Differences between 1.19 and version 1.20
Log of other versions for file ai05s/ai05-0158-1.txt

--- ai05s/ai05-0158-1.txt	2013/10/24 02:20:31	1.19
+++ ai05s/ai05-0158-1.txt	2013/11/01 01:25:34	1.20
@@ -412,12 +412,26 @@
       A_Range_Attribute_Reference
       A_Simple_Expression_Range
 
-[Editor's note: What happens with the existing Membership_Test_Range and
-Membership_Test_Subtype? They could be made obsolete (the new routine covers
-all of the possible cases). Also, there is no wording in those routines
-to specify what exception is raised if the wrong kind of membership expression
-is passed in.]
+functions Membership_Test_Range and Membership_Test_Subtype_Mark are made
+obsolescent, with a suggested replacement of Membership_Test_Choices.
 
+The wording of Membership_Test_Range is updated to say:
+
+Raises ASIS_Inappropriate_Element with a
+Status of Value_Error for any element that does not have one of these expected
+kinds, or if the element represents a membership with more than one choice, or
+if the element represents a membership whose choice is not of
+A_Range_Attribute_Reference or A_Simple_Expression_Range Constraint_Kind.
+
+The wording of Membership_Test_Subtype_Mark is updated to say:
+
+Raises ASIS_Inappropriate_Element with a
+Status of Value_Error for any element that does not have one of these expected
+kinds, or if the element represents a membership with more than one choice, or
+if the element represents a membership whose choice is not of
+An_Identifier, A_Selected_Component or An_Attribute_Reference Expression_Kind,
+or does not represent a subtype_mark.
+
 !appendix
 
 From: Robert Dewar
@@ -2814,3 +2828,166 @@
 change.
 
 ****************************************************************
+
+From: Randy Brukardt
+Date: Wednesday, October 23, 2013  8:36 PM
+
+ASIS-for-GNAT defines a routine Membership_Test_Choices to handle the extended
+choices of a membership in Ada 2012.
+
+What should the existing routines Membership_Test_Range and
+Membership_Test_Subtype do in that case? There is no text allowing them to fail
+if the wrong kind of membership item is given. Humm, I suppose this is an old
+problem, as one could call Membership_Test_Range with an element signifying
+"X in Integer". There ought to be some text in 16.35 and 16.36 to the effect
+that some exception is raised if the "wrong" kind of membership is given. Which
+exception should that be?? (Or should it return Nil_Element? That too would
+have to be specified.)
+
+[Note: The existing wording says "Raises ASIS_Inappropriate_Element with a
+Status of Value_Error for any element that does not have one of these expected
+kinds.", but of course "X in Integer" has the appropriate kind. But it still
+isn't going to return the correct kind of element from Membership_Test_Range
+because there is no range to return.]
+
+Arguably, the existing routines should be marked as obsolete. The new routine
+covers all of the possible cases, and doesn't have the problem of having to
+reject half of the possible memberships as both of the existing routines do.
+But perhaps that is going too far.
+
+Thoughts?
+
+****************************************************************
+
+From: Randy Brukardt
+Date: Wednesday, October 23, 2013  8:40 PM
+
+FMI, this relates to the !ASIS section in AI05-0158-1.
+
+P.S. "FMI" - For My Information - because I doubt most of you care what AI it's in.
+
+P.P.S. The rest of you can do your ASIS homework too, like I'm bending my brain
+around now. ;-)
+
+****************************************************************
+
+From: Tucker Taft
+Date: Thursday, October 24, 2013  9:53 AM
+
+> Arguably, the existing routines should be marked as obsolete. The new 
+> routine covers all of the possible cases, and doesn't have the problem 
+> of having to reject half of the possible memberships as both of the 
+> existing routines do. But perhaps that is going too far.
+
+I would mark the old ones as obsolescent, if the new one covers all the bases.
+
+****************************************************************
+
+From: Randy Brukardt
+Date: Thursday, October 24, 2013  2:23 PM
+
+ARG: Sergey responded to this question but forgot to cc the ARG list; his
+response is below.
+
+Sergey: Thanks, that's what I suspected. I'll update the AI when I file this
+mail (the existing problem with the old functions really should be a separate
+SI, but that would be just busywork at this point).
+
+> -----Original Message-----
+> From: Sergey I. Rybin [mailto:rybin@adacore.com]
+> Sent: Thursday, October 24, 2013 2:50 AM
+> To: randy@rrsoftware.com
+> Subject: Re: FW: Memberships in Ada 2012 ASIS
+> 
+> Randy Brukardt wrote:
+> > What does GNAT-for-ASIS do in these cases? - RLB
+> 
+> --------------------------------------------------------------
+> ----------------
+> --  17.34 function Membership_Test_Range
+> --------------------------------------------------------------
+> ----------------
+> 
+>     function Membership_Test_Range
+>       (Expression : Asis.Expression)
+>        return       Asis.Range_Constraint;
+> 
+>     pragma Obsolescent
+>       (Membership_Test_Range,
+>        "use Membership_Test_Choices instead");
+> 
+> --------------------------------------------------------------
+> ----------------
+> --  Expression  - Specifies the membership test operation to query
+> --
+> --  Returns the range following the reserved words "in" or "not in" from the
+> --  membership test.
+> --
+> --  This query is kept for applications that are supposed to process Ada code
+> --  that corresponds to the Ada Language Reference manual up to the version
+> --  known as Ada 2005. It can process arguments that represent membership tests
+> --  that:
+> --
+> --  * have exactly one choice in membership_choice_list
+> --
+> --  * this choice is of A_Range_Attribute_Reference or
+> --    A_Simple_Expression_Range Constraint_Kind
+> --
+> --  Any argument that does not satisfy these conditions raises
+> --  ASIS_Inappropriate_Element
+> --
+> --  Appropriate Expression_Kinds:
+> --      An_In_Membership_Test
+> --      A_Not_In_Membership_Test
+> --
+> --  Returns Constraint_Kinds:
+> --       A_Range_Attribute_Reference
+> --       A_Simple_Expression_Range
+> --
+> --------------------------------------------------------------
+> ----------------
+> --  17.35 function Membership_Test_Subtype_Mark
+> --------------------------------------------------------------
+> ----------------
+> 
+>     function Membership_Test_Subtype_Mark
+>       (Expression : Asis.Expression)
+>        return       Asis.Expression;
+> 
+>     pragma Obsolescent
+>       (Membership_Test_Subtype_Mark,
+>        "use Membership_Test_Choices instead");
+> 
+> --------------------------------------------------------------
+> ----------------
+> --  Expression  - Specifies the membership test operation to query
+> --
+> --  Returns the subtype_mark expression following the reserved words "in" or
+> --  "not in" from the membership test.
+> --
+> --  This query is kept for applications that are supposed to process Ada code
+> --  that corresponds to the Ada Language Reference manual up to the version
+> --  known as Ada 2005. It can process arguments that represent membership tests
+> --  that:
+> --
+> --  * have exactly one choice in membership_choice_list
+> --
+> --  * this choice is of An_Identifier, A_Selected_Component or
+> --    An_Attribute_Reference Expression_Kind, and represents a subtype_mark
+> --
+> --  Any argument that does not satisfy these conditions raises
+> --  ASIS_Inappropriate_Element
+> --
+> --  Appropriate Expression_Kinds:
+> --      An_In_Membership_Test
+> --      A_Not_In_Membership_Test
+> --
+> --  Returns Expression_Kinds:
+> --       An_Identifier
+> --       A_Selected_Component
+> --       An_Attribute_Reference
+> --
+
+****************************************************************
+
+

Questions? Ask the ACAA Technical Agent