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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,640a63b200daf902 X-Google-Attributes: gid103376,public From: Jon S Anthony Subject: Re: Access types for procedures Date: 1997/12/15 Message-ID: #1/1 X-Deja-AN: 298530923 References: <3494A820.9E33032F@dsto.defence.gov.au> Distribution: world Organization: PSINet Newsgroups: comp.lang.ada Date: 1997-12-15T00:00:00+00:00 List-Id: Mark Rutten writes: > -- Instantiate a generic package which is basically going to > -- queue up messages on an entry to a task and then > -- consecutively call blah with each new message. > -- > package New_Effector is new G_Effector( > in_name=> "output", > in_procedure => blah); Put this in a library level package. It can be the entire package. > The generic package has a single externally accessible > procedure, called Effect, which has the same declarative > form as blah, i.e. > procedure Effect(msg: in Message); > > The message declarations are in their own package, which > includes the definition of the procedure access type > type Effector_Procedure is access procedure(msg: in message); By instantiating the generic in your main procedure, the resulting Effect procedure has a deeper (1 level) scope than the procedure access type which is defined in the (presumably) library level package with the message decls and such. This causes the access level mismatch. > However I can insert the above code into a package and > supply a procedure in this package which creates and > sends the message. I can then get the same functionality > as above by calling this procedure from the main procedure, > but then this error does not appear and everything works > happily. Right - the resulting procedure from the instantiation is still at library level in this case. /Jon -- Jon Anthony Synquiry Technologies, Ltd., Belmont, MA 02178, 617.484.3383 "Nightmares - Ha! The way my life's been going lately, Who'd notice?" -- Londo Mollari