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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,2e6723b897ab47fb X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Received: by 10.66.80.166 with SMTP id s6mr1315797pax.30.1344847627484; Mon, 13 Aug 2012 01:47:07 -0700 (PDT) Path: g9ni53389124pbo.0!nntp.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news-in-01.newsfeed.easynews.com!easynews.com!easynews!novia!news-peer1!btnet!zen.net.uk!hamilton.zen.co.uk!xlned.com!feeder3.xlned.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!80.86.168.138.MISMATCH!news-feed.eu.lambdanet.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Ada.Locales pseudo-string types Date: Wed, 08 Aug 2012 14:44:48 +0300 Organization: Tidorum Ltd Message-ID: References: <78707b6e-88a3-453a-a37c-840f7a62e703@googlegroups.com> <7303f906-0f6a-4d97-ae15-36b4056ede6c@googlegroups.com> <257b4f44-b6c6-4c79-8c6e-dec947a3ce25@googlegroups.com> Mime-Version: 1.0 X-Trace: individual.net DUrHZjF/e/7VBQ8/NiNsUQIwJ32DFSEUuSNISxxf+XM8lablY3R/OMr7LFd8Y9bA0r Cancel-Lock: sha1:TdRbmggqYCJx/bbnNfkzBDfnba4= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: X-Received-Bytes: 3341 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: 2012-08-08T14:44:48+03:00 List-Id: On 12-08-08 11:33 , J-P. Rosen wrote: > Le 08/08/2012 10:17, Niklas Holsti a �crit : >>> And of course, it would force pass-by-copy >> >> I don't think so. If the source and target element subtypes statically >> match, > then the conversion is allowed Yes, and for sure the compiler could detect this case, and use the fast code. So it would not have to make a copy. >> or match well enough that no element conversions are necessary >> (as in the original Ada.Locales example), the compiled code could be the >> same as compilers use now. > But they won't match the other way round, and passing a conversion to > in-out parameters requires two-way conversion That is a view conversion. I was talking about value conversions, as was the original poster, I believe. >> In other cases, the compiler could create a >> temporary array to hold the result of the conversion, and pass this >> array by reference. > If you make a copy and pass it by reference, I would call it pass by > copy ;-) What you call a "copy" is the result of converting the array. If the conversion rules are relaxed, this may not be an exact bit-by-bit copy of the original array any more (for example, if conversion from integer elements to float elements is allowed). This is just the same as when the actual parameter is a function call that returns an array type. The result of the function can be passed by reference, although the object is no doubt a temporary one. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .