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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,1aa620874a64e7a6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-10 04:23:08 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!fr.ip.ndsoftware.net!teaser.fr!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "David C. Hoos, Sr." Newsgroups: comp.lang.ada Subject: Re: Instantiating generics Date: Wed, 10 Dec 2003 06:21:17 -0600 Organization: Cuivre, Argent, Or Message-ID: References: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: melchior.cuivre.fr.eu.org 1071058904 35394 80.67.180.195 (10 Dec 2003 12:21:44 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Wed, 10 Dec 2003 12:21:44 +0000 (UTC) Cc: comp.lang.ada@ada-france.org To: "Albert" Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.3 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:3304 Date: 2003-12-10T06:21:17-06:00 ----- Original Message ----- From: "Albert" Newsgroups: comp.lang.ada To: Sent: December 10, 2003 4:36 AM Subject: Re: Instantiating generics > On Tue, 09 Dec 2003 06:10:20 -0600, David C. Hoos wrote: > > > We would be more able to help you if you told us what the > > problem is -- e.g., what error message did you get from the > > compiler? > > Yes, of course, i'm sorry about that.... > > albert@itaka:~/Ada/practica$ gnatmake demostration.adb > gnatgcc -c demostration.adb > demostration.adb:8:18: warning: not dispatching (must be defined in a package spec) > demostration.adb:13:09: missing actual for instantiation of "Is_Valid" > demostration.adb:13:09: instantiation abandoned > gnatmake: "demostration.adb" compilation error As is almost always the case with gnat, the messages from the compiler are very precise, and tell you exactly what the problem is. Here, it is telling you that the instantiation of the gheneric package Queue_Manager_1 is missing the actual parameter for the formal parameter Is_Valid, required by Queue_Manager_1. There are two ways to correct this, viz.: 1. You can supply the parameter explicitly like this: package QMP is new Queue_Manager_1 (Element => O_Positive; Is_Valid => is_Valid); 2. You can change the definition of the formal parameter Is_Valid in Queue_Manager_1, like this: with function Is_Valid(Data : Element) return Boolean is <>; -- 6 instead of with function Is_Valid(Data : Element) return Boolean; -- 6 The addition of the "is <>" to the formal paramter declaration tells the compiler to supply the required actual parameter if one with the same name and profile is visible at the point of instantiation. I warn you now, that when you make one or the other of these changes you will encounter some new problems, but it is better for your learning experience to see them for yourself, and see whether you can fix them yourself, based on what the compiler tells you. If you cannot solve them, let us know, and we'll try to help. > > Albert > > > > > "Albert" wrote in message > > news:pan.2003.12.09.10.02.31.801470@menta.net... > >> I'm trying to instantiate the Queue_Manager_1 example from 12.3 > >> Ada Distillier, the problem is the function Is_Valid. > >> > >> with Queue_Manager_1; > >> > >> procedure Demostration is > >> type O_Positive is tagged > >> record > >> Val:Positive; > >> end record; > >> function Is_Valid(Data:O_Positive) return Boolean is > >> begin > >> return True; > >> end Is_Valid; > >> package QMP is new Queue_Manager_1(Element=>O_Positive); > >> begin > >> null; > >> end Demostration; > >> > >> > >> Can anyone help me�. > >> thanks > >> > >> Albert > >> > >> > >> _______________________________________________ > >> comp.lang.ada mailing list > >> comp.lang.ada@ada-france.org > >> http://www.ada-france.org/mailman/listinfo/comp.lang.ada > >> > >> > > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada-france.org > http://www.ada-france.org/mailman/listinfo/comp.lang.ada > >