* Exceptions in (dynamic) predicates @ 2013-10-31 21:52 Simon Wright 2013-10-31 23:34 ` Adam Beneschan 0 siblings, 1 reply; 5+ messages in thread From: Simon Wright @ 2013-10-31 21:52 UTC (permalink / raw) A StackOverflow answer contains the following code: subtype XYZ is ABC with Dynamic_Predicate => ((XYZ.A in Positive) and (XYZ.B not in Positive)) or else raise Constraint_Error; (actually, the original didn't have the 'else', with unhelpful results :) I can't see where in the ARM "raise Constraint_Error" can be a (component of a) boolean expression? or is this a GNATism? ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Exceptions in (dynamic) predicates 2013-10-31 21:52 Exceptions in (dynamic) predicates Simon Wright @ 2013-10-31 23:34 ` Adam Beneschan 2013-11-02 6:23 ` Randy Brukardt 0 siblings, 1 reply; 5+ messages in thread From: Adam Beneschan @ 2013-10-31 23:34 UTC (permalink / raw) On Thursday, October 31, 2013 2:52:36 PM UTC-7, Simon Wright wrote: > A StackOverflow answer contains the following code: > > subtype XYZ is ABC > with Dynamic_Predicate => > ((XYZ.A in Positive) and > (XYZ.B not in Positive)) or else raise Constraint_Error; > > (actually, the original didn't have the 'else', with unhelpful results :) > > I can't see where in the ARM "raise Constraint_Error" can be a > (component of a) boolean expression? or is this a GNATism? Maybe it's AI12-0022? http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0022-1.txt Looks like it's a planned addition to Ada 202x. -- Adam ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Exceptions in (dynamic) predicates 2013-10-31 23:34 ` Adam Beneschan @ 2013-11-02 6:23 ` Randy Brukardt 2013-11-04 16:20 ` Adam Beneschan 0 siblings, 1 reply; 5+ messages in thread From: Randy Brukardt @ 2013-11-02 6:23 UTC (permalink / raw) "Adam Beneschan" <adambeneschan@aol.com> wrote in message news:700ca98a-a6d6-47af-a7d6-fe23cf2729b2@googlegroups.com... > On Thursday, October 31, 2013 2:52:36 PM UTC-7, Simon Wright wrote: >> A StackOverflow answer contains the following code: >> >> subtype XYZ is ABC >> with Dynamic_Predicate => >> ((XYZ.A in Positive) and >> (XYZ.B not in Positive)) or else raise Constraint_Error; >> >> (actually, the original didn't have the 'else', with unhelpful results :) >> >> I can't see where in the ARM "raise Constraint_Error" can be a >> (component of a) boolean expression? or is this a GNATism? > > Maybe it's AI12-0022? > > http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0022-1.txt > > Looks like it's a planned addition to Ada 202x. Well, actually it's an after-the-fact addition to Ada 2012. (AI12-0022-1 is a Binding Interpretation, not an Amendment 1.) We realized that we needed it at the last meeting before sending out the Standard wording, but we couldn't get the details right at the meeting and decided to look at it later. Within a few weeks after the meeting, we had figured out the appropriate semantics. The problem is that without it, you can't replace existing natural language text specifications (that is, comments) with preconditions and predicates, because the exception raised would change. That doesn't seem helpful. The Ada 2012 Rationale Epilogue discusses this (and the following) -- although you'll have to wait until next week for it to be on-line at ada-auth.org. Note that for a predicate, you really should use the new Predicate_Failure aspect rather than putting the exception in the predicate proper, because otherwise memberships and validity checks would raise the exception instead of returning the appropriate True or False answer. (That took a lot longer to work out, but that's less jarring as aspects can be added at any time and by implementers.) subtype XYZ is ABC with Dynamic_Predicate => (XYZ.A in Positive) and (XYZ.B not in Positive), Predicate_Failure => raise Constraint_Error; See the Rationale Epilogue for a better explanation that I can put here. Not sure exactly when GNAT will support Predicate_Failure (we only nailed it down at the June meeting), but I'd expect it to be soon. Randy. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Exceptions in (dynamic) predicates 2013-11-02 6:23 ` Randy Brukardt @ 2013-11-04 16:20 ` Adam Beneschan 2013-11-21 23:48 ` Randy Brukardt 0 siblings, 1 reply; 5+ messages in thread From: Adam Beneschan @ 2013-11-04 16:20 UTC (permalink / raw) On Friday, November 1, 2013 11:23:04 PM UTC-7, Randy Brukardt wrote: > "Adam Beneschan" wrote in message > > http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0022-1.txt > > Looks like it's a planned addition to Ada 202x. > > Well, actually it's an after-the-fact addition to Ada 2012. (AI12-0022-1 is > a Binding Interpretation, not an Amendment 1.) I noticed that the !class was "binding interpretation", but the !status is "Amendment 202x". What does that mean, exactly? Anyway, thanks for the explanation. -- Adam ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Exceptions in (dynamic) predicates 2013-11-04 16:20 ` Adam Beneschan @ 2013-11-21 23:48 ` Randy Brukardt 0 siblings, 0 replies; 5+ messages in thread From: Randy Brukardt @ 2013-11-21 23:48 UTC (permalink / raw) "!class Amendment 202x" just means that this would be included in the next Ada Amendment document (whenever that is requested). At this point, it's mostly an aid for my work on keeping the RM up-to-date with ARG decisions (important for ACATS tests and implementers). As it turns out, WG 9 is leaning toward requesting a Corrigendum from the ARG instead, so these will be changed soon to "!class Corrigendum 2014". Randy. "Adam Beneschan" <adambeneschan@aol.com> wrote in message news:23975e4f-c518-4144-8d2c-020b05f56133@googlegroups.com... > On Friday, November 1, 2013 11:23:04 PM UTC-7, Randy Brukardt wrote: >> "Adam Beneschan" wrote in message > >> > http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0022-1.txt >> > Looks like it's a planned addition to Ada 202x. >> >> Well, actually it's an after-the-fact addition to Ada 2012. (AI12-0022-1 >> is >> a Binding Interpretation, not an Amendment 1.) > > I noticed that the !class was "binding interpretation", but the !status is > "Amendment 202x". What does that mean, exactly? Anyway, thanks for the > explanation. > > -- Adam ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-11-21 23:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-10-31 21:52 Exceptions in (dynamic) predicates Simon Wright 2013-10-31 23:34 ` Adam Beneschan 2013-11-02 6:23 ` Randy Brukardt 2013-11-04 16:20 ` Adam Beneschan 2013-11-21 23:48 ` Randy Brukardt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox