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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ffef1fd08e45df0c X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s22.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: using put procedure with a generic package References: <151bc418-a6e4-47ef-ab7f-5b93a3cedb58@r66g2000hsg.googlegroups.com> In-Reply-To: <151bc418-a6e4-47ef-ab7f-5b93a3cedb58@r66g2000hsg.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1210219765 12.201.97.213 (Thu, 08 May 2008 04:09:25 GMT) NNTP-Posting-Date: Thu, 08 May 2008 04:09:25 GMT Organization: AT&T ASP.att.net Date: Thu, 08 May 2008 04:09:25 GMT Xref: g2news2.google.com comp.lang.ada:5746 Date: 2008-05-08T04:09:25+00:00 List-Id: ophir.geffen@gmail.com wrote: > > * queues.ads: > with Ada.Text_IO; > generic > type Item is private; > with procedure Item_Put(The_Item : in Item); Item_Put has exactly one parameter. > package Int_IO is new Ada.Text_IO.Integer_IO(Integer); > package Int_Queues is new Queues(Item => Integer, Item_Put => > Int_IO.Put); --- error here > > The package compiles on its own, but when I try to compile Test_Queues > there is an error: > no visible subprogram matches the specification for "Item_Put" Ada.Text_IO.Integer_IO has the following procedures named Put: procedure Put(File : in File_Type; Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base); procedure Put(Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base); procedure Put(To : out String; Item : in Num; Base : in Number_Base := Default_Base); None of these has exactly one parameter. That's why Int_IO.Put doesn't match Item_Put. You can call the 2nd of these with only one explicit parameter: Int_IO.Put (Item => 7); but it still has 3 parameters; the other 2 get the default values as the actual parameters. You need to create a procedure that matches Item_Put: procedure Put (Item : in Integer) is -- null; begin -- Put Int_IO.Put (Item => Item); end Put; and use it to instantiate your generic package. -- Jeff Carter "I unclog my nose towards you." Monty Python & the Holy Grail 11