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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8cca2e0315177d3b X-Google-Attributes: gid103376,public From: Jeff Carter Subject: Re: Instantiating a generic formal procedure with an access procedure value Date: 2000/01/04 Message-ID: <84rnbm$8jo$1@nnrp1.deja.com>#1/1 X-Deja-AN: 567948098 References: <84guh6$emh$1@nnrp1.deja.com> <3870E3F1.906FDFF4@averstar.com> X-Http-Proxy: 1.0 x42.deja.com:80 (Squid/1.1.22) for client 205.188.198.33 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Tue Jan 04 02:53:46 2000 GMT X-MyDeja-Info: XMYDJUIDjrcarter001 Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; AOL 5.0; Windows 95; DigExt; Freei Client 2.1) Date: 2000-01-04T00:00:00+00:00 List-Id: In article <3870E3F1.906FDFF4@averstar.com>, Tucker Taft wrote: > Jeff Carter wrote: > > procedure Op (Item : in out Handle; Item : in Integer); > > I presume you mean ------------------->>> Element : in Integer <<< Yes, thanks for pointing out that error. > > procedure Iterate (Action : in Action_Ptr) is > > procedure Local is new S_U.Iterate (Action => ???); > > -- What do I use here? > > Action.all is the name of a subprogram. It happens to have > convention "protected" but that is irrelevant to a generic > formal subprogram, which should accept subprograms of any > convention. I don't see why it should have convention "protected", since Action_Ptr is defined in the spec of package S and the actual procedure pointed to by a call to Iterate must be declared at the library level. However, that should be irrelevant. > As usual, without the actual source and the actual error message, > it will be hard to determine where the real problem lies. > But it may be a compiler bug... > > Action.all is the correct thing to use as the actual for a generic > formal subprogram. That's what I thought. Using type Handle is new Integer; for the full definition of S_U.Handle (which is irrelevant but necessary for compilation), and a body of S with Action.all: package body S is protected body Handle is procedure Op (Element : in Integer) is begin -- Op S_U.Op (Item => Data, Element => Element); end Op; procedure Iterate (Action : in Action_Ptr) is procedure Local is new S_U.Iterate (Action => Action.all); begin -- Iterate Local (Over => Data); end Iterate; end Handle; end S; I get these messages from GNAT 3.11p s.adb:9:10: instantiation abandoned s.adb:9:63: missing argument for parameter "Element" s.adb:11:10: "Local" is undefined I realize that 3.12p is current, but I lack the bandwidth to download it right now. It may be a compiler error, and may be corrected in 3.12p or in compilers from other vendors, but I'd like confirmation that other compilers do accept this. Thanks for taking the time to think about this. -- Jeff Carter "Now go away or I shall taunt you a second time." -- Monty Python and the Holy Grail Sent via Deja.com http://www.deja.com/ Before you buy.