comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: generic with function procedure
Date: Fri, 12 Jun 2020 07:29:28 -0700 (PDT)
Date: 2020-06-12T07:29:28-07:00	[thread overview]
Message-ID: <7683dd8f-73c9-4c18-b198-a574759e4e24o@googlegroups.com> (raw)
In-Reply-To: <3a31389d-d554-46f5-930e-495192b1fbcbo@googlegroups.com>

On Wednesday, June 10, 2020 at 2:21:13 AM UTC-6, Gilbert Gosseyn wrote:
> On Tuesday, June 9, 2020 at 6:44:13 PM UTC+2, Shark8 wrote:
> > Now, at this point the compiler cannot do anything more: this is the realm where only the human programmer can tell what to do:
> > — Is it a copy and paste-error creating the functions "g" and "h"? (Were they declared in the form of "f" which is "(v : Real_Vector) return Real;" instead of "(j : Integer; v : Real_Vector) return Real;"?)
> > — Did you perhaps mean to make the formal parameters of denm, "g" and "h", to be "(v : Real_Vector) return Real;" instead of "(j : Integer; v : Real_Vector) return Real;"? (Perhaps being interrupted while refactoring it, and it's stuck in a form intermediate between what you had and what you want.)
> > — Did you forget to make a "g1" and "h1"?
> 
> Apparently the problem is solved when I make the parameter list for f, g, and h the same.
But is it?
Take a look at the first point I raised:
* Is it a copy and paste-error creating the functions "g" and "h"?

IOW, which is appropriate? A function with signature "(v : Real_Vector) return Real;", or a function with signature "(j : Integer; v : Real_Vector) return Real;"?

> It must be a well known fact when using more than one with. However, I missed it.
It doesn't really have to do with WITH, but with (a) the generic's formal declaration, and (b) the functions visible at instantiation... WITH is only relevant here when using it to pull compilation units into visibility, but even that can be blocked/overriden (e.g.) by locally declaring a function of the same name.

  parent reply	other threads:[~2020-06-12 14:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 14:35 generic with function procedure Gilbert Gosseyn
2020-06-05 14:52 ` gautier_niouzes
2020-06-05 15:45   ` Gilbert Gosseyn
2020-06-05 15:59     ` Dmitry A. Kazakov
2020-06-05 16:09       ` Anh Vo
2020-06-05 20:28     ` Jeffrey R. Carter
2020-06-09 16:44 ` Shark8
2020-06-10  8:21   ` Gilbert Gosseyn
2020-06-10  8:45     ` AdaMagica
2020-06-12 14:29     ` Shark8 [this message]
2020-06-12 16:45     ` Simon Wright
2020-06-12 18:49       ` Simon Wright
replies disabled

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