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 22:34:13 +0100	[thread overview]
Message-ID: <ruq1sk$etg$1@gioia.aioe.org> (raw)
In-Reply-To: d2ad937c-7b15-4766-aa88-c0a9ce474f0bn@googlegroups.com

On 2021-01-26 21:04, Shark8 wrote:
> On Tuesday, January 26, 2021 at 12:44:45 PM UTC-7, Dmitry A. Kazakov wrote:
>> Instantiation errors nobody can really predict. On top of that is
>> uncontrollable name space pollution.
> I submitted an AI that solves a lot of the pollution:
> http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0268-1.txt?rev=1.3&raw=N

Well, it would have only limited use.

The case you present is rather solved by using child generics as they 
"inherit" parameters. So

    generic
    package Generic_Swap.Generic_Stack is

And here we come to the real-world problem. Generic packages and their 
formal parameters are organized in a directed acyclic graph like:

     A   D
    / \ /|
   B   C |
    \ /  |
     E   |
      \ /
       F

rather than a tree. You want to instantiate the whole graph in a single 
shot. You do not want to manually specify constraints on generic formal 
parameters when some of them travel by several paths as D into F.

BTW, observe similarity with diamond/rhombus MI. That MI has some 
problems generics do not have is a big lie.

But in my view generics are beyond salvation. The idea is inherently 
weakly typed. Ada's generic contracts are too loose to be safe and too 
rigid for usability of C++ templates.

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

  reply	other threads:[~2021-01-26 21:34 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
2021-01-26 20:04                   ` Shark8
2021-01-26 21:34                     ` Dmitry A. Kazakov [this message]
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