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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-05 05:22:40 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-out.visi.com!petbe.visi.com!news.octanews.net!ash.uu.net!spool.news.uu.net!not-for-mail Date: Thu, 05 Feb 2004 08:22:40 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031013 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: In-Out Parameters for functions References: <1075390647.405841@master.nyc.kbcfp.com> <1075405582.982776@master.nyc.kbcfp.com> <1075482385.142744@master.nyc.kbcfp.com> <1075732402.294581@master.nyc.kbcfp.com> <1075741279.952497@master.nyc.kbcfp.com> <16nu1099ekujjbpe9dqvs3noi9sdcfja6e@4ax.com> <1075817212.745748@master.nyc.kbcfp.com> <1075824683.769215@master.nyc.kbcfp.com> <1075851506.238480@master.nyc.kbcfp.com> <4020C947.81A6D703@0.0> <1075907239.138068@master.nyc.kbcfp.com> <402232E9.3EE15B4B@0.0> In-Reply-To: <402232E9.3EE15B4B@0.0> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1075987360.225622@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@carrots.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1075987360 27852 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:5248 Date: 2004-02-05T08:22:40-05:00 List-Id: Stuart Palin wrote: > But the premise in many of your other postings in this > thread seems to be concerned with resolving the case where > the expression [currently] has an 'ambiguous' value. Yes. > As has already been pointed out in this thread, an Ada > compiler can not determine - simply from its specification - > whether a function will have a side-effect or not. Yes. > Ada seems to have (as > a matter of pragmatism) chosen not to prohibit certain > aspects of ambiguity because the potential benefits [in a > wide range of cases] out-weigh the pitfalls. Those benefits being? > allowing compilers to find an optimal implementation order But you are now talking about finding an optimal implementation order for an expression involving more than one function call where the compiler has no access to the body of the functions. Do you really think that allowing the compiler to pick the order of the calls will significantly affect the efficiency? > - including concurrent computation. I don't see how this can possibly be allowed, unless the compiler can see the bodies to inline them. The standard allows operands and arguments to be evaluated in arbitrary order, but concurrent execution would completely break any functions that accessed common data structures. > This may seem even more reasonable if one acknowledges there > are other cases where ambiguous behaviour can arise - for > instance data aliasing through parameter passing Eliminating sources of ambiguity is a good thing even if not all of them can be removed. > If your proposal to define the execution order were to be > adopted, how might a programmer write the Ada code to > express their intent that they don't care what order the > expression is executed in They could not, just as they cannot specify this for sequences of statements. If you write x := a + b; y := c + d; you may not care which statement is executed first, but you have no way of telling this to the compiler. Either the compiler can figure this out for itself, or it can't. > How much do you think this [manual optimization] would add > to/detract from the clarity of the code? I think this is non-existent now, and will continue to be so. > How do you think someone who is writing applications for a > target that offers high levels of parallel computation would > feel about it? They would feel that order of evaluation is completely orthogonal to their concerns.