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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5556ca7de188d5ef X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-12 00:39:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-FFM2.ecrc.net!news.iks-jena.de!lutz From: lutz@iks-jena.de (Lutz Donnerhacke) Newsgroups: comp.lang.ada Subject: Re: Multidimensional array vs. array of array Date: Wed, 12 Dec 2001 08:39:28 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1008146368 14406 217.17.192.37 (12 Dec 2001 08:39:28 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Wed, 12 Dec 2001 08:39:28 +0000 (UTC) User-Agent: slrn/0.9.6.3 (Linux) Xref: archiver1.google.com comp.lang.ada:17820 Date: 2001-12-12T08:39:28+00:00 List-Id: * Stephen Leake wrote: >lutz@iks-jena.de (Lutz Donnerhacke) writes: >> How does a skilled Ada programmer define a return type containing a >> multidimensional array? > >I suspect the answer is : you don't. Define a procedure with an 'in >out' parameter instead. Or one 'in' and one 'out'. Parameters of unconstraint type always have the constraints as in parameters. In order to obtain the constraints from the calling procedure, you have to return an unconstraint type. Returning a multidimensional array is easy. Returning an array of arrays is impossible. A multidimensional array is often unusable in further processes. There a array of arrays is necessary. Of course, I can use Unchecked_Conversion, but this is not portable and not a good style. >> But this approach fails miserably on extracting a single row from the >> result as well as on construction the result in a recursive function. > >Yes, this is a fundamental limitation. If you think about a reasonable >implementaion of multi-dimensional arrays, and what you are asking the >compiler to do, it will make sense that it is a limitation. I read all the discussions about Ada83/95 multidimensional arrays and know where the limitation comes from. But I still ask: How does a skilled Ada programmer return a array of arrays?