From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE, XPRIO autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: New aggregates with Ada 2022. Date: Tue, 28 Jun 2022 23:07:01 -0500 Organization: A noiseless patient Spider Message-ID: References: Injection-Date: Wed, 29 Jun 2022 04:07:06 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="7f4db9ab6d5e834606da4c4c7cf7249b"; logging-data="1422007"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/qmVF3n+31OrK5yJyH7bwLwBO3T2mlqtU=" Cancel-Lock: sha1:g3CHlSZp0DACX+W3liIU97ZEMW8= X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 X-Priority: 3 X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MSMail-Priority: Normal Xref: reader01.eternal-september.org comp.lang.ada:64044 List-Id: What you say here is precisely how they should work. But you would make the cost of supporting that necessary on every array object, because one could not know when an array is passed as a parameter what sort of representation it has. So one has to use dispatching helper operations to implement all assignments. And that's way more expensive than traditional array implementation. If you didn't have slices that could be passed as array parameters, then that problem does not exist. And I don't think slices are sufficiently worthwhile to force expensive, unoptimizable code. Randy. "Dmitry A. Kazakov" wrote in message news:t9ebvc$1amt$1@gioia.aioe.org... > On 2022-06-27 23:37, Randy Brukardt wrote: > >> The distributed overhead that they cause is >> immense (for instance, you can't have a discontigious array >> represesentation >> with slices, unless you are willing to pay a substantial cost for *every* >> array parameter). They're the anti-abstraction feature. > > There is nothing wrong with having non-contiguous slices of non-contiguous > arrays! Contiguity of index does not automatically imply contiguity of > element allocation, unless specifically required by the [sub]type > constraint. > > 1D array abstraction is a mapping index -> element where > > 1. Index has an order. Index has operations 'Succ and 'Pred; > > 2. The mapping is convex. If there are elements for two indices, then > there are elements for all indices between them. > > Contiguity is a representation constraint. > > One should be able to have an array equivalent of unbounded string with > unbounded slices both allocated non-contiguously. The slices you could > shrink or expand: > > Text (45..80) := ""; -- Cut a piece off > > At the same time one should have a contiguous subtype of the same > unbounded string for interfacing purposes, dealt by copy-out copy-in. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de