CVS difference for ai05s/ai05-0153-3.txt
--- ai05s/ai05-0153-3.txt 2011/03/17 06:13:16 1.13
+++ ai05s/ai05-0153-3.txt 2011/04/09 06:28:44 1.14
@@ -1,4 +1,4 @@
-!standard 3.2.4(0) 11-03-16 AI05-0153-3/07
+!standard 3.2.4(0) 11-04-07 AI05-0153-3/08
!class Amendment 09-05-27
!status Amendment 2012 11-03-04
!status ARG Approved 7-0-1 10-02-18
@@ -136,8 +136,8 @@
3.2.4 Subtype Predicates
The language-defined "predicate aspects" Static_Predicate and Dynamic_Predicate
-may be used to define properties of subtypes. A "predicate clause" is an aspect
-clause specifying one of the two predicate aspects.
+may be used to define properties of subtypes. A "predicate specification" is an
+aspect_specification for one of the two predicate aspects.
Name Resolution Rules
@@ -147,9 +147,9 @@
Static Semantics
-A predicate clause may be given on a type_declaration or a subtype_declaration,
-and applies to the declared subtype. In addition, predicate clauses apply to
-certain other subtypes:
+A predicate specification may be given on a type_declaration or a
+subtype_declaration, and applies to the declared subtype. In addition, predicate
+specifications apply to certain other subtypes:
- For a (first) subtype defined by a derived type
declaration, the predicates of the parent subtype and the
@@ -159,13 +159,13 @@
predicate of the subtype denoted by the subtype_mark
applies.
-The "predicate" of a subtype consists of all predicate clauses that apply,
-and-ed together; if no predicate clauses apply, the predicate is True
-Redundant[(in particular, the predicate of a base subtype is True)].
+The "predicate" of a subtype consists of all predicate specifications that
+apply, and-ed together; if no predicate specifications apply, the predicate is
+True Redundant[(in particular, the predicate of a base subtype is True)].
Legality Rules
-The expression of a Static_Predicate clause shall be "predicate-static";
+The expression of a Static_Predicate specification shall be "predicate-static";
that is, one of the following:
- a static expression that does not raise any exception;
@@ -188,13 +188,14 @@
An index subtype, discrete_range of an index_constraint or slice, or a
discrete_subtype_definition of a constrained_array_definition,
entry_declaration, or entry_index_specification shall not denote a
-subtype to which predicate clauses apply.
+subtype to which predicate specifications apply.
The prefix of an attribute_reference whose attribute_designator is First, Last,
-or Range shall not denote a scalar subtype to which predicate clauses apply.
+or Range shall not denote a scalar subtype to which predicate specifications
+apply.
The discrete_subtype_definition of a loop_parameter_specification shall not
-denote a subtype to which Dynamic_Predicate clauses apply.
+denote a subtype to which Dynamic_Predicate specifications apply.
Dynamic Semantics
@@ -230,7 +231,7 @@
with similar rules, even though it's not really necessary, since Program_Error
will be raised anyway.
-NOTE: A predicate clause does not cause a subtype to be considered
+NOTE: A predicate specification does not cause a subtype to be considered
"constrained".
NOTE: A Static_Predicate, like a constraint, always remains True for all
@@ -303,14 +304,15 @@
Add to the end of 4.9(26/2), so subtypes with Static_Predicates can be static,
but those with Dynamic_Predicate are not:
- Also, a subtype is not static if any Dynamic_Predicate clauses apply to it.
+ Also, a subtype is not static if any Dynamic_Predicate specifications apply
+ to it.
Modify 4.9.1(2/2), so static matching takes predicates into account:
A subtype statically matches another subtype of the same type if they have
- statically matching constraints, {all predicate clauses that apply to them
- come from the same declarations, }and, for access subtypes, either both or
- neither exclude null. ...
+ statically matching constraints, {all predicate specification that apply to
+ them come from the same declarations, }and, for access subtypes, either both
+ or neither exclude null. ...
Modify 4.9.1(4/3), so "statically compatible" takes predicates into account:
@@ -332,7 +334,7 @@
- either:
- - all predicate clauses that apply to S2 apply also to S1, or
+ - all predicate specifications that apply to S2 apply also to S1, or
- both subtypes are static, and every value that obeys S1's
predicate also obeys S2's predicate.}
@@ -2741,5 +2743,88 @@
predicated array type.
Thanks.
+
+****************************************************************
+
+From: John Barnes
+Sent: Thursday, April 7, 2011 4:07 AM
+
+Since this is up for voting again I am going to take the opportunity to say once
+more that I think that this AI is a big mistake (specifically Static_Predicate).
+I expect it will be regretted some time in the future when the ARG gets around
+to discussing sets properly.
+
+****************************************************************
+
+From: Robert Dewar
+Sent: Friday, April 8, 2011 6:10 PM
+
+And I think that static predicates are THE most interesting and useful feature
+of Ada 2012, I am quite sure that GNAT will implement them even if they are
+removed from Ada 2012 (seeing as
+
+a) they are already implemented
+b) they turn out to be very useful
+c) we are using them!)
+
+****************************************************************
+
+From: Robert Dewar
+Sent: Friday, April 8, 2011 6:11 PM
+
+By the way, I don't see what static predicates have to do with sets per se.
+
+****************************************************************
+
+From: Randy Brukardt
+Sent: Saturday, April 9, 2011 1:18 AM
+
+...
+> And I think that static predicates are THE most interesting and useful
+> feature of Ada 2012, ...
+
+I wouldn't go quite that far (preconditions would have to be high on the list),
+but since they provide the set constraints that Ada never had and always has
+needed, I do agree that they are very useful.
+
+> By the way, I don't see what static predicates have to do with sets per se.
+
+Well, they provide a way to get the effect of a set constraint, along with other
+sorts of constraints.
+
+Robert was replying to John:
+
+> I expect it will be regretted some time in the future when the ARG gets around
+> to discussing sets properly.
+
+I doubt that will ever happen, in part because the static predicates provide all
+of the functionality needed. But mainly because AI05-0158-1 has used the
+"obvious" syntax for a set in such a way that it is likely that any set
+functionality would be ambiguous. That has nothing to do with static predicates;
+I don't see any problem with the predicates themselves no matter what other
+constructs we might add.
+
+We'd have to add some new dedicated set syntax (like using square brackets) to
+add first-class sets. But why would we want them? Set membership is handled by
+the extended membership test, and set constraints are handled by static
+predicates. So the only thing you can't do natively is dynamically construct a
+set to use in those contexts -- and that can be handled adequately by a set
+package (and dynamic predicates), since it that isn't commonly used.
+
+So I don't see why we'd want to spend a lot of effort on "proper sets", whatever
+that is. It's probably about 400th on the priority list for Ada 2020...
+
+****************************************************************
+
+From: Bob Duff
+Sent: Thursday, April 7, 2011 6:07 PM
+
+New version of AI05-0153-3, Subtype predicates, based on the April 7, 2011 phone
+meeting. [This is version /08 - Editor.] Tucker suggested changing "predicate
+clause" to "predicate specification".
+
+Gary suggested getting rid of this term altogether, but that would require
+saying "specification of a predicate aspect" or some such, which is a bit of a
+mouthful, and it's used many times, so I went with Tucker's suggestion.
****************************************************************
Questions? Ask the ACAA Technical Agent