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,50856407da0f240e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.234.38 with SMTP id ub6mr748459pbc.2.1340309178968; Thu, 21 Jun 2012 13:06:18 -0700 (PDT) MIME-Version: 1.0 Path: l9ni4336pbj.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: why this construct causes aliasing problem in 2012 with functions allowing In Out? Date: Thu, 21 Jun 2012 15:06:15 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <2adb0da6-9b6e-4514-b703-f0a6261ecc5b@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1340309177 11850 69.95.181.76 (21 Jun 2012 20:06:17 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 21 Jun 2012 20:06:17 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-RFC2646: Format=Flowed; Original Date: 2012-06-21T15:06:15-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:ikgnsser1io8$.1ofpbj9hcpcio.dlg@40tude.net... ... > Well, there exist possibilities to address the issue. The issue *is* addressed. Either the slide or the summary of it is wrong. > Let the language provided means to contract the evaluation order of some > operations. > > Arguments having contracted side effects (like change(...) with its in out > parameters) would be illegal for any operation having no contracted > evaluation order, e.g. "-". This would make > > two := change(one,two) + change(one,two) > > illegal. No need to "make it" illegal; it IS illegal. But when the order is specified, e.g. left to right for string > "&", then side effects in arguments would be permitted: > > Name : String := Read (Socket) & Read (Socket); I don't think the order is specified for "&"; that's the first I've heard of it. In any case, this is the actual rule used in Ada 2012 (it only applies when the order is unspecified, see the quote I previously posted). The result is pretty complex, but normally, the compiler will tell you when you did something bad; otherwise, it isn't worth much energy to understand. But this comes back to Adam's point: it wasn't worth trying to make a special case for operators that are communative when used alone, so there is no exception for "+" or any other case when the result does not actually depend on the order (but could have with a different body). Randy.