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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!reality.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Mixing operators and dot notation Date: Thu, 2 Jun 2016 18:26:12 -0500 Organization: JSA Research & Innovation Message-ID: References: NNTP-Posting-Host: rrsoftware.com X-Trace: franka.jacob-sparre.dk 1464909951 1783 24.196.82.226 (2 Jun 2016 23:25:51 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 2 Jun 2016 23:25:51 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:30564 Date: 2016-06-02T18:26:12-05:00 List-Id: "Robert A Duff" wrote in message news:wccshwvgr8n.fsf@TheWorld.com... > "Alejandro R. Mosteo" writes: > >> I'm trying to abuse Ada syntax for nefarious purposes and have arrived > ^^^^^ Probably an apt description. ;-) > >> at something that looks inconsistent to me, but I fail to see if it is > ^^^^^^^^^^^^ > Yes, the rules are inconsistent. > >> expected behavior or a bug. This is a self-contained example which is >> below. > >> Op (1, 2).Method; -- Fine >> >> -- (1 & 2).Method; -- Error: statement expected > > That's syntactically illegal; take a look at the BNF. > But you can say: > > Nest.Object'Class'(1 & 2).Method; > > Ada makes a syntactic distinction between 'name' and 'expression', > which I think is unwise. ARG has been chipping away at it over > the years. Anyway, nowadays, a qualified_expression is a name, > so if you have an expression you want to use as a name, you can > just qualify it. True (for Ada 2012), but it probably defeats the purpose to do that. (If you have to know the full expanded names of everything, there's little value to prefix notation in the first place.) You also can write: "&" (1, 2).Method which might defeat the purpose less. (Or not, not knowing the actual intent.) Also to Bob's point, a type conversion always has been a name, so that: Nest.Object'Class(1 & 2).Method; is syntactically legal in Ada 2005 as well, but it not resolve (the operand of a type conversion can't use the context in any way, so it depends on what & operators are visible as to whether this would work). This was the reason that we changed Ada 2012, since it is silly that type conversions would be allowed somewhere, but qualified expressions (which just confirm the type) would not be. Randy.