comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: New aggregates with Ada 2022.
Date: Thu, 23 Jun 2022 11:32:11 +0200	[thread overview]
Message-ID: <t91buq$10im$1@gioia.aioe.org> (raw)
In-Reply-To: t90ebe$nve$1@dont-email.me

On 2022-06-23 03:06, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> 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

  reply	other threads:[~2022-06-23  9:32 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-19  7:59 New aggregates with Ada 2022 Blady
2022-06-19 14:15 ` Simon Wright
2022-06-20 19:36   ` Blady
2022-06-20 22:01     ` Simon Wright
2022-06-20 21:47 ` Randy Brukardt
2022-06-20 22:18   ` Dmitry A. Kazakov
2022-06-21 23:28     ` Randy Brukardt
2022-06-22  9:04       ` Dmitry A. Kazakov
2022-06-23  1:06         ` Randy Brukardt
2022-06-23  9:32           ` Dmitry A. Kazakov [this message]
2022-06-23 10:53             ` G.B.
2022-06-24  1:21               ` Randy Brukardt
2022-06-24  1:24             ` Randy Brukardt
2022-06-24  6:50               ` Dmitry A. Kazakov
2022-06-25  3:13                 ` Randy Brukardt
2022-06-25  8:50                   ` Dmitry A. Kazakov
2022-06-27 21:37                     ` Randy Brukardt
2022-06-28  5:36                       ` Niklas Holsti
2022-06-29  4:01                         ` Randy Brukardt
2022-06-29  8:30                           ` Jeffrey R.Carter
2022-06-29  9:04                             ` Dmitry A. Kazakov
2022-06-30  5:03                               ` Randy Brukardt
2022-06-30  8:44                                 ` Dmitry A. Kazakov
2022-06-29 11:06                             ` Niklas Holsti
2022-06-29 12:53                               ` Jeffrey R.Carter
2022-06-30  5:07                                 ` Randy Brukardt
2022-06-30  5:14                               ` Randy Brukardt
2022-06-30  8:31                                 ` Marius Amado-Alves
2022-07-01  5:20                                   ` Randy Brukardt
2022-06-30 10:30                                 ` Jeffrey R.Carter
2022-06-30 15:48                                   ` Marius Amado-Alves
2022-06-30 16:39                                     ` Jeffrey R.Carter
2022-07-01  0:07                                       ` Marius Amado-Alves
2022-06-28  7:52                       ` Dmitry A. Kazakov
2022-06-29  4:07                         ` Randy Brukardt
2022-06-29  7:24                           ` Dmitry A. Kazakov
2022-06-30  5:00                             ` Randy Brukardt
2022-06-21 23:39     ` Randy Brukardt
2022-06-22  8:26       ` Dmitry A. Kazakov
2022-06-23  1:10         ` Randy Brukardt
2022-06-23  9:32           ` Dmitry A. Kazakov
2022-06-20 22:10 ` Jesper Quorning
2022-06-20 22:59   ` Jesper Quorning
2022-06-21 23:20     ` Randy Brukardt
replies disabled

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