From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: urgent question - generics
Date: Mon, 3 Sep 2007 17:01:14 +0200
Date: 2007-09-03T17:00:50+02:00 [thread overview]
Message-ID: <gzon52oo5y10.1omjcw52uwfpj$.dlg@40tude.net> (raw)
In-Reply-To: 46dc14fb$0$3230$39db0f71@news.song.fi
On Mon, 03 Sep 2007 17:08:28 +0300, Niklas Holsti wrote:
> It's still unclear to me if the OP wants the parameterless
> procedure (Proc, above) to be a generic parameter (as in Pascal's
> solution) that is associated with an actual procedure when the
> generic function is instantiated, or a non-generic parameter to the
> (generic) function that is associated with an actual procedure when
> an instance of the generic function is called (as in "anon's"
> non-generic solution where only the address of the procedure was used).
I doubt that the exercise would use the word "generic" in this case. Just:
function Bar (...; Foo : access procedure) return ...; -- Ada 2005
type Foo_Ptr is access procedure;
function Bar (...; Foo : Foo_Ptr) return ...; -- Ada 95
But OK, in order to add a bit more confusion (:-)), there also could be a
generic function which formal generic parameter is an instance of a generic
parameterless procedure. Here it goes:
generic
...
package I_Have_A_Foo is -- We need an envelope package
procedure Foo;
end I_Have_A_Foo;
generic
with package Here_Is_My_Foo is new I_Have_A_Foo (<>);
function Bar (...) return ...;
Moreover, there could be a generic function which formal generic parameter
is inherited from a generic ancestor:
generic
with procedure Foo;
package I_Take_Foo is ... end I_Take_Foo;
generic
function I_Take_Foo.Bar (...) return ...;
Being a child of I_Take_Foo, Bar receives Foo from its parent. I hope that
would suffice to perplex the prof... (:-))
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2007-09-03 15:01 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-03 8:47 urgent question - generics shoshanister
2007-09-03 9:14 ` Pascal Obry
2007-09-03 9:28 ` shoshanister
2007-09-03 9:58 ` Dmitry A. Kazakov
2007-09-03 10:19 ` shoshanister
2007-09-03 10:48 ` Markus E L
2007-09-03 13:41 ` Pascal Obry
2007-09-03 14:08 ` Niklas Holsti
2007-09-03 14:44 ` Pascal Obry
2007-09-03 15:01 ` Dmitry A. Kazakov [this message]
2007-09-03 14:36 ` Jean-Pierre Rosen
2007-09-03 16:46 ` shoshanister
2007-09-03 19:58 ` Georg Bauhaus
2007-09-03 10:23 ` anon
2007-09-03 10:42 ` Niklas Holsti
2007-09-03 10:58 ` shoshanister
2007-09-03 11:04 ` Georg Bauhaus
2007-09-03 11:06 ` shoshanister
2007-09-03 12:00 ` Georg Bauhaus
2007-09-03 11:24 ` anon
2007-09-03 11:36 ` shoshanister
2007-09-03 13:01 ` anon
2007-09-03 16:35 ` shoshanister
2007-09-04 0:38 ` anon
2007-09-04 6:38 ` Georg Bauhaus
2007-09-05 3:47 ` anon
2007-09-05 10:11 ` Georg Bauhaus
2007-09-05 12:36 ` To Georg Bauhaus anon
2007-09-05 13:50 ` Keep slang words in describing Ada programming? (was: To Georg Bauhaus) Georg Bauhaus
2007-09-05 14:40 ` To new TROLL named Georg Bauhaus anon
2007-09-05 18:10 ` Georg Bauhaus
[not found] ` <op.tx7g6crr5afhvo@dogen>
2007-09-06 2:54 ` anon
2007-09-06 9:20 ` Markus E L
2007-09-06 6:15 ` Dirk Heinrichs
2007-09-06 9:18 ` Markus E L
2007-09-05 11:37 ` urgent question - generics Markus E L
2007-09-03 13:27 ` Ludovic Brenta
2007-09-03 13:18 ` Markus E L
2007-09-03 10:56 ` Markus E L
2007-09-05 3:49 ` Troll -- Markus E L anon
2007-09-05 11:35 ` Markus E L
2007-09-03 16:18 ` urgent question - generics tmoran
2007-09-03 21:39 ` anon
2007-09-03 11:39 ` gautier_niouzes
2007-09-03 11:59 ` shoshanister
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox