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

Differences between 1.4 and version 1.5
Log of other versions for file ai05s/ai05-0183-1.txt

--- ai05s/ai05-0183-1.txt	2010/04/29 03:24:11	1.4
+++ ai05s/ai05-0183-1.txt	2010/04/29 06:27:42	1.5
@@ -417,6 +417,69 @@
 
 !appendix
 
+From: Yannick Moy
+Sent: Tuesday, April 20, 2010  8:58 AM
+
+I would like to question the following legality rule for user-defined kinds of
+aspect_mark:
+
+"At most one occurrence of each aspect_mark is allowed within a single
+aspect_specification."
+
+Indeed, it could be useful to have multiple user aspects of the same kind. This
+is the case, e.g., for an aspect we could add to GNAT, which would give the
+ability to specify unit tests, as in:
+
+function Sqrt (X : Integer) return Integer
+  with Test => if X > 100 then Sqrt'Result >= 10,
+       Test => if X < 100 then Sqrt'Result < 10,
+       Test => if X = 100 then Sqrt'Result = 10,
+       Test => Sqrt'Result >= 0;
+
+Notice that this aspect is essentially a special kind of postcondition. The goal
+in having a special aspect for it and allowing multiple occurrences of this
+aspect on the same subprogram is to allow compilers and analysis tools to treat
+differently postconditions and these sorts of specifications for unit tests.
+
+As a side note, notice that, although not needed in the example above, it will
+in general be necessary to use attribute 'Old to refer to the pre-state of the
+call, like in:
+
+procedure Sqrt (X : in out Integer)
+  with Test => if X'Old > 100 then X >= 10;
+
+I was told that the "with Blah => ..." syntax is meant to be more-or-less
+equivalent to "for ...'Blah use ...". Then, allowing multiple aspects of the
+same kind could require that such aspects are named in some way, so that you can
+access them in the code with 'Blah("name")?
+
+As Bob suggested that I submit an exact wording, I'll only propose for now:
+
+"Unless specified otherwise for a specific aspect_mark, more than one occurrence
+of each aspect_mark is allowed within a single aspect_specification."
+
+****************************************************************
+
+From: Yannick Moy
+Sent: Tuesday, April 27, 2010  11:38 AM
+
+I'll answer my own question, thanks to an idea that Cyrille Comar gave me. He
+proposed that we use different identifiers for different aspects of the same
+kind that apply to the same declaration, so that the Sqrt example I gave in my
+previous email would read:
+
+function Sqrt (X : Integer) return Integer
+  with Test_1 => if X > 100 then Sqrt'Result >= 10,
+       Test_2 => if X < 100 then Sqrt'Result < 10,
+       Test_3 => if X = 100 then Sqrt'Result = 10,
+       Test_4 => Sqrt'Result >= 0;
+
+This is already allowed in the current wording, and it fits our needs well, so
+please ignore the previous request for allowing multiple user aspects of the
+same kind within a single aspect_specification.
+
+****************************************************************
+
 From: Tucker Taft
 Sent: Wednesday, April 28, 2010  2:19 AM
 

Questions? Ask the ACAA Technical Agent