comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: New aggregates with Ada 2022.
Date: Wed, 22 Jun 2022 10:26:34 +0200	[thread overview]
Message-ID: <t8ujnr$1hvf$1@gioia.aioe.org> (raw)
In-Reply-To: t8tks0$aad$1@dont-email.me

On 2022-06-22 01:39, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:t8qrmo$p79$1@gioia.aioe.org...
> ...
>> 1. Built-in operations -> hiding:
>>
>>     type T is private;
>>     function "+" (Left, Right : T) return T; -- Perfectly legal
>> private
>>     type T is range 1..100;
>>
>> 2. Primitive operations -> overriding.
> 
> BTW, these two are really the same thing. In the first example, the "+" is
> overriding the predefined operation.

Yes, they should be in a better world. A primitive operation is always 
reachable. The case above works differently from:

    type T is private;
    overriding
    function "+" (Left, Right : T) return T is abstract;

But this is a deeper problem of having such operations primitive.

> But note an important difference here from the aggregate case: in no case is
> an operation available for the private type that is *not* available for the
> full view. Since the syntax and semantics of container aggregates and array
> aggregate are subtly different (they are as close as we could make them, but
> that is not that close), there definitely are things that would be only
> possible when written for the private view. That would be new for Ada. So
> while a definition could be made, it would be confusing in some cases. And
> this case isn't useful enough to make that effort.

Much could be resolved by attributing proper types to all assumed or 
real intermediate steps:

    type T is private;
    function "+" (Left, Right : T) return T;
private
    type T_Parent is range 1..100;
    type T is new T_Parent;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2022-06-22  8:26 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
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 [this message]
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