From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a05:620a:2290:: with SMTP id o16mr10712888qkh.205.1591371958584; Fri, 05 Jun 2020 08:45:58 -0700 (PDT) X-Received: by 2002:a9d:58c4:: with SMTP id s4mr7800848oth.240.1591371958281; Fri, 05 Jun 2020 08:45:58 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 5 Jun 2020 08:45:57 -0700 (PDT) In-Reply-To: <12b67609-2acc-4a80-88c0-5567a89667f9o@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=2a02:6d40:37c2:c301:a002:bb03:d92f:7eb; posting-account=3Fg1FgoAAACfsmWScNfMD1tGFhR4DU0o NNTP-Posting-Host: 2a02:6d40:37c2:c301:a002:bb03:d92f:7eb References: <12b67609-2acc-4a80-88c0-5567a89667f9o@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8bda92fc-a4aa-46ee-a237-79d41858a8cbo@googlegroups.com> Subject: Re: generic with function procedure From: Gilbert Gosseyn Injection-Date: Fri, 05 Jun 2020 15:45:58 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:58971 Date: 2020-06-05T08:45:57-07:00 List-Id: 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 b= y the way. > Here is a package from Mathpaqs, as an inspiration. >=20 > with Ada.Numerics.Generic_Real_Arrays; >=20 > 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; >=20 > package Generic_Real_Linear_Equations is >=20 > use Real_Arrays; >=20 > 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 func= tions g1 and h1 are defined in the same manner a f1. If I restrict the nume= r 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 us= es different methods in seperate programs with usual parameters. However, t= here are no functions as parameters involved. As in Ada you cannot use fun= ctions as parameters eg in a procedure, the with clause may be used. My pro= blem is still how to use the with clause correctly?