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 autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!aioe.org!siG8trSPtxwtkBCOZpBn8A.user.46.165.242.91.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: New aggregates with Ada 2022. Date: Thu, 23 Jun 2022 11:32:11 +0200 Organization: Aioe.org NNTP Server Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: gioia.aioe.org; logging-data="33366"; posting-host="siG8trSPtxwtkBCOZpBn8A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:64019 List-Id: On 2022-06-23 03:06, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:t8ulu9$jca$1@gioia.aioe.org... >> On 2022-06-22 01:28, Randy Brukardt wrote: > ... >> Well, I can give a useful example straight away. A string has two array >> interfaces, the encoding and the character view. The former must be a >> built-in array. > > The interface for a string should be quite different from that for an array, > they're not related at all. One might implement a string with a record type > that has an array component, but never as a bare array. (That leads to > nonsense, which Ada sadly has proven clearly. String is an array of encoding units, historically and practically. Even at the machine level string instructions deal with arrays. A language unable to support such implementation does not look usable to me. > Indeed, if you consider everything to have an interface, arrays themselves > cease to be a fundemental part of a language design and just become another > interface. Everything has interface just because it is the way human brain works. The language design question is what interfaces deserve to be formalized and exposed in the language as entities the programmer can reference, check against etc. In Ada array interface is exposed in generics as a formal array, but not in the type system proper. In any case having an explicit array interface does not preclude built-in arrays. > (How something gets implemented should not be part of a language > design, so long as the design does not prevent an efficient implementation.) > I certainly would not treat them as special in any way, just a series of > function calls. (Possibly records could be treated that way as well, > although it is less clear that an efficient implementation is possible for > them.) Syntax sugar for subprogram calls is not enough because it does not allow generic programming. One should be able to write a program that deals with any instance of the interface. Like a generic body working with any actual array or a class-wide body which unfortunately is impossible to have for arrays presently. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de