comp.lang.ada
 help / color / mirror / Atom feed
From: "amo...@unizar.es" <amosteo@unizar.es>
Subject: Re: Calling inherited primitive operations in Ada
Date: Mon, 5 Sep 2022 01:53:19 -0700 (PDT)	[thread overview]
Message-ID: <6d7f82cf-a52a-4fbe-b9f7-f06e55e76429n@googlegroups.com> (raw)
In-Reply-To: <teu5gp$2m0pg$1@dont-email.me>

On Saturday, September 3, 2022 at 2:01:32 AM UTC+2, Randy Brukardt wrote:
> "amo...@unizar.es" <amo...@unizar.es> wrote in message 
> news:672e9bc6-1e53-42cb...@googlegroups.com...
> On Thursday, September 1, 2022 at 11:33:47 PM UTC+2, Jeffrey R.Carter wrote: 
> > On 2022-09-01 20:54, Emmanuel Briot wrote: 
> 
> >> As presented, this seems very over complicated. Elements and 
> >> Definite_Elements 
> >> add no value, and this is just a complex way of writing 
> 
> >Going in a tangent, and I guess you know perfectly well, but this is caused 
> >by the 
> >painful duplication of code that Ada pushes you to by not having a native 
> >way to 
> >abstract storage of definite vs indefinite types.

> This is premature optimization at it's worst.

Just because the language doesn't offer a way to do it. Otherwise I wouldn't need to care.

> > So the provider of a generic library very soon faces this conundrum about 
> > duplicating most interfaces, if not implementations, or resort to 
> > non-trivial 
> > generics, or accept an unnecessary penalty for definite types, or push to 
> > the client the definite storage matter.
> There is no penalty in a code sharing implementation like Janus/Ada: the 
> implementation of definite types is essentially the same as you would write 
> by hand for an indefinite type. In most cases, all one needs is an 
> indefinite generic. 

Well, that sounds neat for Janus/Ada, but is a different issue to clients having to wrap their indefinite types prior to instantiation, and suffer the unwrapping throughout the code.

> (The plan for Janus/Ada was always to use post-compilation optimization to 
> reduce the overhead of generics, but admittedly, that part never got built. 
> If I had infinite time...) 
> 
> Assuming otherwise is certainly premature optimization.

I'm of the opinion that it goes beyond just premature optimization, in the terrain of readability/maintainability by causing boilerplate, and when generics specializations do become necessary, by causing code duplication.

> > There's simply no satisfying solution here [that I know of]. The 
> > duplication of 
> > every standard container to have both [in]definite variants is a strong 
> > indictment.
> The original expectation for the containers was that there would be many 
> variants of each container, because the needs for memory management, task 
> management, and persistence differ between applications: there is no 
> one-size fits all solution. 
> 
> But I agree on one point: the "basic" container is unncessary; one should 
> either use the indefinite or bounded container (depending on your memory 
> management needs, either fully fixed or fully heap-based) -- stopping in the 
> middle makes little sense. 

That makes sense, right.

> 
> Randy.

      reply	other threads:[~2022-09-05  8:53 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31  8:15 Calling inherited primitive operations in Ada Emmanuel Briot
2022-08-31 17:11 ` DrPi
2022-08-31 19:13 ` Dmitry A. Kazakov
2022-09-01  6:56   ` Emmanuel Briot
     [not found]     ` <67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
2022-09-01 10:02       ` Dmitry A. Kazakov
2022-09-01 11:59       ` Jeffrey R.Carter
2022-09-01 12:37         ` Dmitry A. Kazakov
2022-09-01 13:37           ` Jeffrey R.Carter
2022-09-01 14:10             ` Emmanuel Briot
2022-09-01 15:50               ` amo...@unizar.es
2022-09-01 16:03               ` Jeffrey R.Carter
2022-09-01 16:07                 ` Emmanuel Briot
2022-09-01 16:17                   ` Jeffrey R.Carter
2022-09-01 18:54                     ` Emmanuel Briot
2022-09-01 21:33                       ` Jeffrey R.Carter
2022-09-02  6:11                         ` Emmanuel Briot
2022-09-02 10:55                           ` Jeffrey R.Carter
2022-09-02 11:20                             ` Emmanuel Briot
2022-09-02 14:28                               ` Jeffrey R.Carter
2022-09-03  0:16                               ` Randy Brukardt
2022-09-03  0:07                           ` Randy Brukardt
2022-09-03  8:59                             ` Jeffrey R.Carter
2022-09-07  0:42                               ` Randy Brukardt
2022-09-03 19:00                             ` Simon Wright
2022-09-05  6:56                               ` Emmanuel Briot
2022-09-05  7:34                                 ` Dmitry A. Kazakov
2022-09-05  9:30                                 ` Jeffrey R.Carter
2022-09-07  0:51                                 ` Randy Brukardt
2022-09-02  8:35                         ` amo...@unizar.es
2022-09-02  8:48                           ` Dmitry A. Kazakov
     [not found]                             ` <9484a755-f55d-407e-a40b-92421b0bcafbn@googlegroups.com>
2022-09-02  9:55                               ` Dmitry A. Kazakov
2022-09-02 10:41                           ` Jeffrey R.Carter
2022-09-02 11:04                             ` Dmitry A. Kazakov
2022-09-03  0:12                               ` Randy Brukardt
2022-09-03  8:23                                 ` Dmitry A. Kazakov
2022-09-03  0:01                           ` Randy Brukardt
2022-09-05  8:53                             ` amo...@unizar.es [this message]
replies disabled

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