comp.lang.ada
 help / color / mirror / Atom feed
From: Andrew Lynch <lynch@cci.de>
Subject: Generic using another generic instantiated elsewhere
Date: 1998/02/13
Date: 1998-02-13T00:00:00+00:00	[thread overview]
Message-ID: <34E41D3B.474B@cci.de> (raw)


Hi,

a colleague of mine, who is fairly new to Ada, came to me with the
following "problem". I'm not quite sure what to suggest to him, so
hopefully you can provide some hints or ideas.

He has two generic packages, one of which contains a task.
They are both instantiated in the main program. He wants to call
an entry of the task from within the other generic package.
Eg. something like this (not good Ada):

generic
   Some_Type ...
   Some_Procedure ...
package Foo is
   ...
   task Some_Task is
      entry do_foo ...
   end Some_Task;
end Foo;

generic
   Some_Other_Type ...
   Some_Other_Procedure ...
package Bar is
   ...
   procedure FooBar;
end Bar;

package body Bar is
   procedure FooBar is
   begin
      ...
      My_Foo.Some_Task.do_foo( ... );
      -- somehow call the do_foo entry
      -- of the My_Foo instantiation below!
   end FooBar;
end Bar;

procedure Main is
   My_Foo is new Foo();
   My_Bar is new Bar();
begin
   ... call FooBar somewhere
end Main;


They are using Ada 83 and I doubt this is possible(*).
Should I tell him to "forget the whole thing", or are there other
ways to achieve a similar effect?

(*) In Ada 95 I guess it would be possible to use a generic formal
package for this, ie. pass My_Foo to the instantiation of Bar?

Cheers,
Andrew.




             reply	other threads:[~1998-02-13  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-13  0:00 Andrew Lynch [this message]
1998-02-13  0:00 ` Generic using another generic instantiated elsewhere Roger Racine
replies disabled

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