From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: extended membership tests (branch)
Date: Thu, 31 Mar 2011 16:10:26 -0500
Date: 2011-03-31T16:10:26-05:00 [thread overview]
Message-ID: <in2qk6$3rp$1@munin.nbi.dk> (raw)
In-Reply-To: 247eef65-9ff3-4268-af73-e74d092c1e82@k10g2000prh.googlegroups.com
"Adam Beneschan" <adam@irvine.com> wrote in message
news:247eef65-9ff3-4268-af73-e74d092c1e82@k10g2000prh.googlegroups.com...
On Mar 31, 9:28 am, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
wrote:
>> for b in b1 in b1 .. b1 loop
>> null;
>> end loop;
>
>See AARM 3.5(3.a). "for b in" has to be followed by either a subtype
>name, a 'Range attribute, or two "simple expressions" with .. between
>them. In the last case, the bounds must be "simple expressions", not
>general expressions. The syntax of simple_expressions doesn't allow
>membership tests (except in parentheses). So the above is illegal.
>This rule has been there since Ada 95.
Right. The only incompatibility involved with this new feature is with case
statements. A membership test now needs to be parenthesized, as it did in
Ada 83, but Ada 95 and Ada 2005 allowed it not to be in parens.
when X in Y => -- Illegal in Ada 83 and Ada 2012, legal in Ada 95 and Ada
2005.
when (X in Y) => -- OK everywhere.
The reason is that something like:
when X in Y | Z =>
would be ambiguous without the parens.
Beyond that, the likelyhood of writing something like this is pretty small
anyway (why write a case statement on type Boolean??).
Randy.
-- Adam
next prev parent reply other threads:[~2011-03-31 21:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-31 7:04 extended membership tests Dan
2011-03-31 7:34 ` AdaMagica
2011-03-31 7:55 ` Dan
2011-03-31 7:58 ` Dan
2011-03-31 8:05 ` Ludovic Brenta
2011-03-31 9:28 ` AdaMagica
2011-03-31 14:33 ` Robert A Duff
2011-03-31 16:28 ` extended membership tests (branch) Georg Bauhaus
2011-03-31 17:58 ` Robert A Duff
2011-03-31 18:54 ` Adam Beneschan
2011-03-31 21:08 ` Georg Bauhaus
2011-03-31 21:10 ` Randy Brukardt [this message]
2011-04-01 5:14 ` extended membership tests AdaMagica
2011-04-01 6:33 ` Dan
2011-04-01 7:03 ` AdaMagica
2011-04-01 9:56 ` stefan-lucks
2011-04-01 15:11 ` Adam Beneschan
2011-04-02 1:22 ` 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