comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: generic with function procedure
Date: Fri, 12 Jun 2020 17:45:32 +0100
Date: 2020-06-12T17:45:32+01:00	[thread overview]
Message-ID: <lypna4w7v7.fsf@pushface.org> (raw)
In-Reply-To: 3a31389d-d554-46f5-930e-495192b1fbcbo@googlegroups.com

Gilbert Gosseyn <hnptz@yahoo.de> writes:

> Apparently the problem is solved when I make the parameter list for f,
> g, and h the same. (it must be a well known fact when using more than
> one with. However, I missed it). Thanks to all contributors.

If you'd posted this question on the [ada] tag on StackOverflow, we'd
have probably closed the question because you haven't shown us the code
that you couldn't get to work!

Show us the original failing declarations of F, G, and H and then we can
tell you more.

It is most definitely *not* a "well known fact" that the parameter lists
of all subprogram arguments to a generic have to be the same. In fact,
that suggestion is completely false.

Simple compiling demo:

procedure Vogt is
   subtype Real is Float;
   type Real_Vector is array (1 .. 10) of Real;

   generic
      with function F(V : Real_Vector) return Real;
      with function G(J : Integer; V : Real_Vector) return Real;
      with function H(J : Integer; V : Real_Vector) return Real;
   procedure Denm (Np,Q,N,M : Integer);

   procedure Denm (Np,Q,N,M : Integer) is null;

   function F1 (V : Real_Vector) return Real is (42.0);
   function G1 (J : Integer; V : Real_Vector) return Real is (42.0);
   function H1 (J : Integer; V : Real_Vector) return Real is (42.0);

   procedure Nm is new Denm (F => F1, G => G1, H => H1);
begin
   null;
end Vogt;

  parent reply	other threads:[~2020-06-12 16:45 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
2020-06-12 16:45     ` Simon Wright [this message]
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