comp.lang.ada
 help / color / mirror / Atom feed
From: Jon S Anthony <jsa@synquiry.com>
Subject: Re: Access types for procedures
Date: 1997/12/15
Date: 1997-12-15T00:00:00+00:00	[thread overview]
Message-ID: <uf4t4a87o1.fsf@synquiry.com> (raw)
In-Reply-To: 3494A820.9E33032F@dsto.defence.gov.au


Mark Rutten <Mark.Rutten@dsto.defence.gov.au> 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




      reply	other threads:[~1997-12-15  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-15  0:00 Access types for procedures Mark Rutten
1997-12-15  0:00 ` Jon S Anthony [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox