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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5188f16fad7607fb X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.76.5 with SMTP id g5mr3989460paw.44.1349707745116; Mon, 08 Oct 2012 07:49:05 -0700 (PDT) Received: by 10.68.219.198 with SMTP id pq6mr4456312pbc.0.1349707745100; Mon, 08 Oct 2012 07:49:05 -0700 (PDT) Path: g9ni23679pbh.1!nntp.google.com!kr7no9650338pbb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 8 Oct 2012 07:49:04 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ NNTP-Posting-Host: 66.126.103.122 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: choice_expression From: Adam Beneschan Injection-Date: Mon, 08 Oct 2012 14:49:05 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-10-08T07:49:04-07:00 List-Id: On Monday, October 8, 2012 6:34:27 AM UTC-7, Maxim Reznik wrote: > Hi, all >=20 > I wounder why Ada 2012 membership test syntax is so complicated? >=20 > membership_choice ::=3D choice_expression | ... >=20 > What for choice_expression is? >=20 > I doubt someone is able to interprete this Ada 2012 expression: >=20 > "False in False and False" I doubt anyone sane would write this expression, so this probably isn't a p= roblem. :) > BTW GNAT understands it as "(False in False) and False" If this isn't a typo, then GNAT is wrong; "and" has a higher precedence tha= n "in", so that A in B and C should be intepreted as A in (B and C). > Then, when you start adding '<', '|' expression became even more complica= ted: >=20 > For example=20 > "False in False and False | True"=20 >=20 > interpreted as >=20 > "False in (False and False) | True" >=20 > I mean allowing relational and ligical operators in choice_expression mak= es syntax unclear, ambiguous and error-prone. >=20 > Why not just =20 >=20 > membership_choice ::=3D simple_expression | ... >=20 > and force user to write brackets around expression? I personally can't imagine using a construct "X in ..." where X is a boolea= n expression. It seems highly useless, except perhaps "X in A'Range" if A = is an array declared with a "boolean range <>" index type, but that itself = should hardly ever be needed. So perhaps that's why it wasn't considered n= ecessary to design special rules for this situation. (On the other hand, s= ome of the issues involving "and [then]" and "or [else]" that led the langu= age designers to require parentheses *do* come up in real life, in other la= nguages.) -- Adam