comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Extend slices for n dimensional arrays for Ada 202X
Date: Fri, 27 Jan 2017 17:30:29 -0600
Date: 2017-01-27T17:30:29-06:00	[thread overview]
Message-ID: <o6gl6n$c9p$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: fb3687c7-0a40-4f8e-abfc-0438a45d2374@googlegroups.com

"Robert Eachus" <rieachus@comcast.net> 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.


  parent reply	other threads:[~2017-01-27 23:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 13:29 REQ: Extend slices for n dimensional arrays for Ada 202X Lucretia
2017-01-26 14:01 ` Lucretia
2017-01-26 14:03   ` Lucretia
2017-01-26 14:52   ` Dmitry A. Kazakov
2017-01-27  9:19     ` Alejandro R. Mosteo
2017-01-27 14:04     ` Lucretia
2017-01-26 18:29 ` Randy Brukardt
2017-01-27  1:54   ` Robert Eachus
2017-01-27  5:39     ` Robert Eachus
2017-01-27 14:06     ` Lucretia
2017-01-27 23:30     ` Randy Brukardt [this message]
2017-01-28  0:58       ` Robert Eachus
2017-01-27  9:34   ` Dmitry A. Kazakov
2017-01-27 13:53     ` G.B.
2017-01-27 14:20       ` Dmitry A. Kazakov
2017-01-27 23:37       ` Randy Brukardt
2017-01-28  9:08         ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox