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!p16g2000yqb.googlegroups.com!not-for-mail From: AdaMagica Newsgroups: comp.lang.ada Subject: Re: extended membership tests Date: Thu, 31 Mar 2011 22:14:22 -0700 (PDT) Organization: http://groups.google.com Message-ID: <5ab2b5ee-d08e-4e5e-93a7-808636f3cfa0@p16g2000yqb.googlegroups.com> 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 1301634863 21353 127.0.0.1 (1 Apr 2011 05:14:23 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 1 Apr 2011 05:14:23 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p16g2000yqb.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:19616 Date: 2011-03-31T22:14:22-07:00 List-Id: On 31 Mrz., 16:33, Robert A Duff wrote: > For extra credit, what happens if we replace b2 with: > > =A0 =A0 b3: boolean :=3D int_sets.to_set(new_item =3D> x) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 in int_sets.to_set(new_item =3D> x) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 or int_sets.to_set(new_item =3D> y); OK, I'll try. We should write this as b3: boolean :=3D int_sets.to_set(new_item =3D> x) in int_sets.to_set(new_item =3D> x) or int_sets.to_set(new_item =3D> y); So the right-hand side is a choice_expression of the form simple_expression or simple_expression. So if there isn't an or operator for sets (I don't know, I didn't check the set container), it's illegal. If there is one, it's a set (presumably the union) and it's the tested_set. The lhs is a simple_expression which is tagged (I presume sets are tagged) which must resolve to a type convertible to the tested type, which it is. Now we have an individual membership test lhs in rhs. The simple expression (lhs) is not equal to the value of the membership_choice (rhs). So the membership test returns False. int_sets.to_set(new_item =3D> x) in int_sets.to_set(new_item =3D> x) | int_sets.to_set(new_item =3D> y); would return True. This doesn't seem very intuitive to me. (Provided that my reading of the RM is correct.)