comp.lang.ada
 help / color / mirror / Atom feed
From: Dan <dan@irvine.com>
Subject: Re: extended membership tests
Date: Thu, 31 Mar 2011 00:58:03 -0700 (PDT)
Date: 2011-03-31T00:58:03-07:00	[thread overview]
Message-ID: <c1c0df9d-d555-4281-b877-6bdd33e2cc4a@b11g2000yqc.googlegroups.com> (raw)
In-Reply-To: 7feb638d-92ca-457a-9a0b-5bf38f55f319@k22g2000yqh.googlegroups.com

On Mar 31, 12:55 am, Dan <d...@irvine.com> wrote:
> On Mar 31, 12:34 am, AdaMagica <christ-usch.gr...@t-online.de> wrote:
>
>
>
>
>
> > On 31 Mrz., 09:04, Dan <d...@irvine.com> wrote:
>
> > > Here's a fun quiz to test your Ada2012 knowledge, based on an
> > > observation by Yannick Moy.
>
> > > Consider this Ada 2012 procedure:
>
> > > with ada.containers.ordered_sets;
> > > procedure membership is
> > >     package int_sets is new ada.containers.ordered_sets(integer);
> > >     function "="(x,y: integer) return boolean is begin return true;
> > > end;
> > >     x: integer := 6;
> > >     y: integer := 12;
> > >     b1: boolean := x in y;
> > >     b2: boolean := x in int_sets.to_set(new_item => y);
> > > begin
> > >     null;
> > > end;
>
> > My first reaction was WTF!
>
> > But RM 4.5.2 seems to make x in y legal, but false here.
>
> > x in y | 1..7
>
> > would be true.
>
> > b2 is illegal, the simple expression must be of an elementary type.
>
> > Hope this is correct.- Hide quoted text -
>
> > - Show quoted text -
>
> I think if the choice(s) resolve to the same type they don't have to
> be elementary,
> according to 4.5.2(3/3).  (other than that, good answer!)- Hide quoted text -
>
> - Show quoted text -

but you are right, they don't the lhs doesn't resolve to the same type
as the rhs,
so in this case the rhs does need to be elementary.



  reply	other threads:[~2011-03-31  7:58 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 [this message]
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
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