comp.lang.ada
 help / color / mirror / Atom feed
From: Gilbert Gosseyn <hnptz@yahoo.de>
Subject: Re: generic with function procedure
Date: Fri, 5 Jun 2020 08:45:57 -0700 (PDT)
Date: 2020-06-05T08:45:57-07:00	[thread overview]
Message-ID: <8bda92fc-a4aa-46ee-a237-79d41858a8cbo@googlegroups.com> (raw)
In-Reply-To: <12b67609-2acc-4a80-88c0-5567a89667f9o@googlegroups.com>

On Friday, June 5, 2020 at 4:52:13 PM UTC+2, gautier...@hotmail.com wrote:
> It depends on how you have defined g1 and h1...
> You may also want to pass Real as a generic parameter to make your "denm" package work for any precision. Perhaps doing so will solve your problem by the way.
> Here is a package from Mathpaqs, as an inspiration.
> 
> with Ada.Numerics.Generic_Real_Arrays;
> 
> generic
>   type Real is digits <>;
>   with package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays (Real);
>   type Integer_Vector is array (Integer range <>) of Integer;
> 
> package Generic_Real_Linear_Equations is
> 
>   use Real_Arrays;
> 
>   function Linear_Equations ( A : Real_Matrix ;
>                               Y : Real_Vector ) return Real_Vector ;
> ...

I used already:
type Real is digits 18;
package Real_Arrays is instantiated with type Real from above.

Please explain: "It depends on how you have defined g1 and h1...". The functions g1 and h1 are defined in the same manner a f1. If I restrict the numer of with-clauses to one, then there is no error-message.

Thank you for your example. I am still studying it and I can see that it uses different methods in seperate programs with usual parameters. However, there are no functions as parameters involved. As in Ada you cannot use  functions as parameters eg in a procedure, the with clause may be used. My problem is still how to use the with clause correctly?

  reply	other threads:[~2020-06-05 15: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 [this message]
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
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