comp.lang.ada
 help / color / mirror / Atom feed
* my instansiation of a generic Remote_Call_Interface need a type declared in a package of wrong categorization
@ 2013-07-25 16:26 dontspam365
  2013-07-25 16:51 ` Jeffrey Carter
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dontspam365 @ 2013-07-25 16:26 UTC (permalink / raw)


Hi!

I have created the following test packages for my question: My_RCI and Test_RCI(generic).
I am trying to create a distributed application. I would like to make several of these packages generic.

In some cases I run into the issue, that I wish to instantiate a Remote_Call_Interface package.
Below I have My_RCI. This package tries to instantiate the necessary packages. However, the __body__ of Test_RCI need a type that is declared in Core_Package. Core_Package is not of correct categorization (and I can't make it become so).
The specification part of Test_RCI and My_RCI are not depending on Core_Package.
As soon as I "with" the Core_Package I get error message of course.
Does it exists some method to "trinkle" Core_Package through to the body of Test_RCI? I have tried quite a few things to solve this, and I have at the moment given up:)

Frank

with Core_Package; --  <- not good :)
with Test_RCI;

package My_RCI is
   pragma Remote_Call_Interface;

   package This is new test_rci  (Core_package.Useful_Type);

   procedure Some_Call;
end My_RCI;

package body My_RCI is

   procedure Some_Call
   is
   begin
      null;
   end Some_Call;
end My_RCI;


generic
   type Some_Type is range <>;
package Test_RCI is
  pragma Remote_Call_Interface;

  procedure Test_RCI;

end Test_RCI;


package body Test_RCI is

   procedure Test_RCI
   is
      A_Variable : Some_Type;
   begin
      A_Variable := 1;
   end Test_RCI;

end Test_RCI;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: my instansiation of a generic Remote_Call_Interface need a type declared in a package of wrong categorization
  2013-07-25 16:26 my instansiation of a generic Remote_Call_Interface need a type declared in a package of wrong categorization dontspam365
@ 2013-07-25 16:51 ` Jeffrey Carter
  2013-07-25 17:00 ` Adam Beneschan
  2013-07-27  3:31 ` Randy Brukardt
  2 siblings, 0 replies; 4+ messages in thread
From: Jeffrey Carter @ 2013-07-25 16:51 UTC (permalink / raw)


On 07/25/2013 09:26 AM, dontspam365@gmail.com wrote:
>
> Does it exists some method to "trinkle" Core_Package through to the body of
> Test_RCI? I have tried quite a few things to solve this, and I have at the
> moment given up:)

Best case: You can pull the type definition out of Core_Package and into another 
pkg with correct categorization, which you then with by both Core_Package and 
your RCI pkg.

Worst case: You cannot modify Core_Package. In this case you'll have to 
duplicate the type declaration in your RCI pkg (or somewhere else with correct 
categorization) and convert to/from your type when making remote calls.

-- 
Jeff Carter
"I like it when the support group complains that they have
insufficient data on mean time to repair bugs in Ada software."
Robert I. Eachus
91


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: my instansiation of a generic Remote_Call_Interface need a type declared in a package of wrong categorization
  2013-07-25 16:26 my instansiation of a generic Remote_Call_Interface need a type declared in a package of wrong categorization dontspam365
  2013-07-25 16:51 ` Jeffrey Carter
@ 2013-07-25 17:00 ` Adam Beneschan
  2013-07-27  3:31 ` Randy Brukardt
  2 siblings, 0 replies; 4+ messages in thread
From: Adam Beneschan @ 2013-07-25 17:00 UTC (permalink / raw)


On Thursday, July 25, 2013 9:26:13 AM UTC-7, donts...@gmail.com wrote:
> Hi!
> 
> 
> 
> I have created the following test packages for my question: My_RCI and Test_RCI(generic).
> 
> I am trying to create a distributed application. I would like to make several of these packages generic.
> 
> 
> 
> In some cases I run into the issue, that I wish to instantiate a Remote_Call_Interface package.
> 
> Below I have My_RCI. This package tries to instantiate the necessary packages. However, the __body__ of Test_RCI need a type that is declared in Core_Package. Core_Package is not of correct categorization (and I can't make it become so).
> 
> The specification part of Test_RCI and My_RCI are not depending on Core_Package.
> 
> As soon as I "with" the Core_Package I get error message of course.
> 
> Does it exists some method to "trinkle" Core_Package through to the body of Test_RCI? I have tried quite a few things to solve this, and I have at the moment given up:)

Can you move your generic instantiation to the body of My_RCI?  It looks like the only thing from the generic's specification that you need in the specification of My_RCI is the procedure Test_RCI.  You could declare that without a generic instantiation in My_RCI's spec, and in the body, make it a rename of This.Test_RCI.

If the specification of Test_RCI is more complex, so that there's a number of things that you want in the generic Test_RCI to be visible in My_RCI, then it might be possible to split the generic Test_RCI into two generic packages so that you instantiate one in My_RCI's spec, and the problematic one in My_RCI's body.  

Note: I haven't tested any of this.

                           -- Adam

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: my instansiation of a generic Remote_Call_Interface need a type declared in a package of wrong categorization
  2013-07-25 16:26 my instansiation of a generic Remote_Call_Interface need a type declared in a package of wrong categorization dontspam365
  2013-07-25 16:51 ` Jeffrey Carter
  2013-07-25 17:00 ` Adam Beneschan
@ 2013-07-27  3:31 ` Randy Brukardt
  2 siblings, 0 replies; 4+ messages in thread
From: Randy Brukardt @ 2013-07-27  3:31 UTC (permalink / raw)


<dontspam365@gmail.com> wrote in message 
news:14e47bb4-a838-47f8-8617-eb404679d3af@googlegroups.com...
...
> Does it exists some method to "trinkle" Core_Package through to the body 
> of Test_RCI? I have tried quite a few things to solve this, and I have at 
> the moment given up:)

If
-- You're using Ada 2012;
-- Core_Package can be preelaborated; and
-- You can move the instantiation into the private part of the RCI. Note 
that you can export the interesting routines from the instance visibly, 
completing them with appropriate renames, to make the routines visible 
outside of the RCI.

In this case, you can do this. Otherwise, you'll have to follow one of the 
other suggestions (splitting Core_Package is probably the best idea, if 
possible).

                     Randy.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-27  3:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-25 16:26 my instansiation of a generic Remote_Call_Interface need a type declared in a package of wrong categorization dontspam365
2013-07-25 16:51 ` Jeffrey Carter
2013-07-25 17:00 ` Adam Beneschan
2013-07-27  3:31 ` Randy Brukardt

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