comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Simple example on interfaces
Date: Tue, 26 Jan 2021 20:44:43 +0100	[thread overview]
Message-ID: <ruprf8$1h6q$1@gioia.aioe.org> (raw)
In-Reply-To: 6e343937-3590-4944-8c38-10b61014e128n@googlegroups.com

On 2021-01-26 17:46, AdaMagica wrote:
> Dmitry A. Kazakov schrieb am Dienstag, 26. Januar 2021 um 12:53:25 UTC+1:
>> The problem with generics (static polymorphism which also includes
>> overloading) is that they answer no to the last question. There cannot
>> be same program because there is no class-wide (polymorphic) objects
>> from the generics' class.
> 
> universal_integer being something like class of all integers, this would be:

Maybe class, maybe parent (cloned upon type X is new Y constructs).

> generic
>    type T is range <>;
> procedure F (X: T);
> 
> is replaced by the classwide
> 
> procedure F (X: universal_integer);  -- not Ada

Or, maybe

    procedure F (X: universal_integer'Class);  -- not Ada

> universal_integer is anonymous and doesn't have any operations (except automatic conversion).

Yes. In a never ending discussion with Randy I insist that this stuff 
should be made explicit, available for any types.

>> P.S. Comparing generics to overloading, generics offer some re-use, and
>> some degree of formalization at the cost of producing huge mess, while
>> overloading does none.
> 
> I know you don't like generics. I do not see a huge mess.

When something goes wrong it is almost impossible to figure what. 
Contracts are mostly implicit. They are not enforced upon compilation. 
Instantiation errors nobody can really predict. On top of that is 
uncontrollable name space pollution.

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

  reply	other threads:[~2021-01-26 19:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 16:08 Simple example on interfaces Mario Blunk
2021-01-25 16:41 ` Dmitry A. Kazakov
2021-01-25 17:51   ` Mario Blunk
2021-01-25 22:06     ` Dmitry A. Kazakov
2021-01-26  7:33       ` G.B.
2021-01-26  8:07         ` Dmitry A. Kazakov
2021-01-26  8:17           ` Mario Blunk
2021-01-26  8:55             ` Dmitry A. Kazakov
2021-01-26  9:37       ` J-P. Rosen
2021-01-26 10:25         ` Dmitry A. Kazakov
2021-01-26 11:15           ` AdaMagica
2021-01-26 11:53             ` Dmitry A. Kazakov
2021-01-26 16:46               ` AdaMagica
2021-01-26 19:44                 ` Dmitry A. Kazakov [this message]
2021-01-26 20:04                   ` Shark8
2021-01-26 21:34                     ` Dmitry A. Kazakov
2021-01-27  3:11                     ` Randy Brukardt
2021-01-27 22:51                       ` Shark8
2021-01-30  8:33                         ` Randy Brukardt
2021-01-27  3:09                   ` Randy Brukardt
2021-01-27  8:05                     ` Dmitry A. Kazakov
2021-01-26 10:02     ` Stephen Leake
2021-01-25 17:00 ` Jeffrey R. Carter
2021-01-27  1:48   ` philip...@gmail.com
2021-01-27  8:06     ` Dmitry A. Kazakov
2021-01-27  3:36   ` Randy Brukardt
2021-01-27 23:04     ` Shark8
2021-01-25 19:05 ` Stephen Leake
replies disabled

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