From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9c9db81a63ddf1fe X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!r14g2000vbm.googlegroups.com!not-for-mail From: AdaMagica Newsgroups: comp.lang.ada Subject: Re: extended membership tests Date: Thu, 31 Mar 2011 00:34:43 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <7dc23d58-4a48-4444-90cd-7f9786b19aad@i14g2000yqe.googlegroups.com> NNTP-Posting-Host: 80.156.44.178 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1301556884 16501 127.0.0.1 (31 Mar 2011 07:34:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 31 Mar 2011 07:34:44 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r14g2000vbm.googlegroups.com; posting-host=80.156.44.178; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:19589 Date: 2011-03-31T00:34:43-07:00 List-Id: On 31 Mrz., 09:04, Dan 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 > =A0 =A0 package int_sets is new ada.containers.ordered_sets(integer); > =A0 =A0 function "=3D"(x,y: integer) return boolean is begin return true; > end; > =A0 =A0 x: integer :=3D 6; > =A0 =A0 y: integer :=3D 12; > =A0 =A0 b1: boolean :=3D x in y; > =A0 =A0 b2: boolean :=3D x in int_sets.to_set(new_item =3D> y); > begin > =A0 =A0 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.