comp.lang.ada
 help / color / mirror / Atom feed
* 'raise' in aspects?
@ 2014-10-18 22:40 Stephen Leake
  2014-10-22  5:42 ` Simon Wright
  2014-10-22 18:08 ` Stephen Leake
  0 siblings, 2 replies; 8+ messages in thread
From: Stephen Leake @ 2014-10-18 22:40 UTC (permalink / raw)


The Ada mode 5.0 parser rejects this code:

   subtype Integer_String is String
     with Dynamic_Predicate => Integer'Value (Integer_String) in Integer
            or else raise Constraint_Error with "not an integer string";

It complains that 'raise' is not allowed here.

ALRM Annex P says the syntax for an aspect is:

     aspect_specification ::= 
        with aspect_mark [=> aspect_definition] {,
                aspect_mark [=> aspect_definition] }

     aspect_mark ::= aspect_identifier['Class]

     aspect_definition ::= name | expression | identifier


And you can't put 'raise' in an expression, which is why the Ada mode
parser rejects it.

But GNAT GPL 2014 accepts it.

Maybe this is from an AI?

Randy says the next Ada version is described in
http://www.ada-auth.org/standards/2xrm/html/RM-13-1-1.html

But that gives the same 'expression' syntax for this.

Hmm; it does add:

36/3
 Alternative legality and semantics rules may apply for particular
 aspects, as specified elsewhere in this International Standard.

(that should be 36/4? 2012 is /3; this is new in 202x. or maybe it's
just a clarificaton of 2012?)

Searching that LRM for Dynamic_Predicate didn't turn up anything about
'raise' in aspects.

There was a recent discussion on comp.lang.ada about the new aspect
Predicate_Failure, and implied that 'raise' was allowed in aspectes,
since the code discussed had that. Predicate_Failure is in the 202x
manual, but it still doesn't give a syntax that allows 'raise'.

Can anyone point me to RM language that allows 'raise' in aspects?

Or maybe this is a GNAT extension? I don't see anything in the GNAT
reference manual about it, but I'm not sure I know where to look.

-- 
-- Stephe


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-10-26  5:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-18 22:40 'raise' in aspects? Stephen Leake
2014-10-22  5:42 ` Simon Wright
2014-10-22  5:45   ` Simon Wright
2014-10-22 18:08 ` Stephen Leake
2014-10-23 22:42   ` Randy Brukardt
2014-10-24  3:22     ` Shark8
2014-10-24  7:20     ` Simon Wright
2014-10-26  5:16       ` Randy Brukardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox