From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Signature Package With Generic Proceedure
Date: Sun, 22 Jul 2012 09:28:53 +0200
Date: 2012-07-22T09:28:53+02:00 [thread overview]
Message-ID: <6mwstm0x0r65$.z95f6vddgx77.dlg@40tude.net> (raw)
In-Reply-To: a1816272-ef92-4402-bc3a-991bd8522697@googlegroups.com
On Sat, 21 Jul 2012 15:22:36 -0700 (PDT), Adam Beneschan wrote:
> On Saturday, July 21, 2012 10:22:25 AM UTC-7, Keean Schupke wrote:
>> If I have a package which defines a procedure like:
>>
>> generic
>> with procedure Process(Set : in out Set_Type);
>> procedure Update(Set : in out Set_Type);
>>
>> How do a declare a Signature package that includes this?
>>
>> generic
>> with generic
>> with procedure Process(Set : in out Set_Type);
>> procedure Update(Set : in out Set_Type);
>> package Set_Signature is end;
>>
>> Is not allowed. Is there some way to do this with nested packages?
>
> There's no such thing as "with generic" in Ada. That is, there is no way
> to set things up so that you can instantiate a generic like this:
>
> package An_Instantiation is new A_Generic (G1);
>
> where G1 is the name of a *generic* subprogram or package. Nor can I
> think of a reason why you'd want to. Perhaps if you gave us an example of
> what you're trying to accomplish?
Probably it is passing an instance of a specific generic procedure to a
generic package?
Note, rather than passing any procedure with matching signature, e.g.
generic
with procedure Foo (...);
package Boo ...
, only such Foo, which is an instance of a generic procedure Baz. Imaginary
syntax borrowed from packages:
generic
with procedure Foo is new Baz (<>); -- This is not Ada!
package Boo ...
This is impossible. An obvious solution is to place Baz into a generic
package and pass an instance of that package instead.
(Ada's generics lack many formal types, e.g. this one)
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2012-07-26 15:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <045f7b44-2a4a-4292-80fd-0b6bc8ee3465@googlegroups.com>
2012-07-21 22:22 ` Signature Package With Generic Proceedure Adam Beneschan
2012-07-22 7:28 ` Dmitry A. Kazakov [this message]
2012-07-22 16:22 ` Keean Schupke
2012-07-23 0:45 ` Adam Beneschan
[not found] ` <79925d0c-b2dd-44a3-9451-48f0ee19485f@googlegroups.com>
[not found] ` <500d3a9d$0$6566$9b4e6d93@newsspool4.arcor-online.net>
2012-07-23 18:29 ` Keean Schupke
[not found] ` <ac8bfaed-dbcc-491a-a760-c25672445eef@googlegroups.com>
2012-07-23 19:41 ` Keean Schupke
2012-07-24 2:57 ` Randy Brukardt
[not found] ` <jul2n4$af5$1@munin.nbi.dk>
2012-07-24 8:02 ` Keean Schupke
2012-07-24 8:43 ` Dmitry A. Kazakov
2012-07-24 8:59 ` Keean Schupke
2012-07-23 10:26 ` Simon Wright
2012-07-23 18:36 ` Keean Schupke
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox