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!news.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: Extend slices for n dimensional arrays for Ada 202X Date: Fri, 27 Jan 2017 17:30:29 -0600 Organization: JSA Research & Innovation Message-ID: References: NNTP-Posting-Host: rrsoftware.com X-Trace: franka.jacob-sparre.dk 1485559831 12601 24.196.82.226 (27 Jan 2017 23:30:31 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 27 Jan 2017 23:30:31 +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:33203 Date: 2017-01-27T17:30:29-06:00 List-Id: "Robert Eachus" wrote in message news:fb3687c7-0a40-4f8e-abfc-0438a45d2374@googlegroups.com... On Thursday, January 26, 2017 at 1:29:07 PM UTC-5, Randy Brukardt wrote: >> So I don't see this happening - it doesn't make sense in the context of >> Ada >> implementation strategies. >Randy, I hope you are confused. I'm not confused. The case in question is a 2-dimensional slice where the sliced components are not (necessarily) contiguous. For instance: type Matrix_Type is array (Positive range <>, Positive range <>) of ...; Matrix : Matrix_Type (1..4, 1..4); procedure Proc (M : in out Matrix_Type); Proc (Matrix (2..3, 2..3)); The problem is that there can be no copying going on here, so the only way to do this is to pass a thunk. Which would necessarily have to be the case for any unconstrained multidimensional parameter passing. Even copying can be an issue, since again the components on both sides can be discontiguous and in different ways. Of course a compiler can optimize the simple cases, but the general case has to be a loop. Single dimensional slices are of course completely different, and I wasn't talking about them. (Although your advice for copying them is 25 years out of date: Intel hardware, at least, automatically makes many of those optimizations so there is no value to manually doing them yourself - that actually would make your code slower.) Randy.