From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.2uCIJahv+a4XEBqttj5Vkw.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Proposal: Auto-allocation of Indefinite Objects Date: Sun, 23 Aug 2020 14:28:21 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <8a502b6c-4609-4cd8-b292-5797fe6421e1n@googlegroups.com> NNTP-Posting-Host: 2uCIJahv+a4XEBqttj5Vkw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:59787 List-Id: On 23/08/2020 06:52, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:rhnqip$bga$1@gioia.aioe.org... >> On 21/08/2020 01:33, Randy Brukardt wrote: >>> "Dennis Lee Bieber" wrote in message >>> news:mkmtjflufgmatkk3hp25nvk2hoogun1fis@4ax.com... >>>> On Thu, 20 Aug 2020 19:49:44 +0200, "Dmitry A. Kazakov" >>>> declaimed the following: >>>> >>>>> >>>>> But records and arrays are needed as building blocks of containers. How >>>>> would you get rid of them? >>>> >>>> And likely needed for any embedded or low-level work where they are >>>> mapped to things like (GP) I/O ports or such... >>> >>> Yes, a fixed vector container would be needed for interfacing (probably >>> wouldn't use it for anything else). But there's no reason that can't be >>> provided as a container, so long as representation guarentees (esp. >>> Component_Size) are included. Remember that containers (in Ada 202x) have >>> indexing, aggregates, and all of the useful basic operations. The stuff >>> that's missing is the same stuff that adds a vast amount of complexity to >>> Ada (and possibilities for bugs) - hardly anyone would miss it. >> >> Really? I would miss array conversions, slices, equivalence of same length >> index ranges, constrained array subtypes etc. > > Those things are mostly useful for making work for programmers. Note that > I'm assuming that Strings are a completely separate abstraction - a UTF-8 > string is not an array and shouldn't be treated as one. (Indexing of > individual characters being very expensive.) That is an implementation detail of a given representation. String of any encoding is an array of characters per definition of string. > Fixed constrained arrays would > be available for interfacing (they're not really useful for much else). I would say it is exactly the opposite. Unconstrained arrays are not very useful because the operation of changing array length is very rare and very expensive (applying your logic). In most cases a fixed array does the work. Note that among the remaining cases, the majority are ones where bounds are still fixed but Ada does not support proper initialization or proper aggregation of. The remainder of that is very small. That small part could, again, be covered by bounded arrays, as you suggested in another post, if Ada supported propagation of constraints in a more effective way than literal discriminants. Presently bounded arrays are practically useless because the place where you must specify the bounds is never the place where you can determine them. > Note > that a bounded vector is allocated statically, so there's no extra cost to > using it (unlike an unbounded vector or string). Maybe, but since there will be arrays anyway, why should I suffer dealing with messy generics? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de