comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: 'raise' in aspects?
Date: Sat, 18 Oct 2014 17:40:02 -0500
Date: 2014-10-18T17:40:02-05:00	[thread overview]
Message-ID: <85siilc88t.fsf@stephe-leake.org> (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


             reply	other threads:[~2014-10-18 22:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-18 22:40 Stephen Leake [this message]
2014-10-22  5:42 ` 'raise' in aspects? 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
replies disabled

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