comp.lang.ada
 help / color / mirror / Atom feed
* Instantiation of a generic with a procedure's scope
@ 1989-12-22 16:19 Brett 'Bunny Killer' Kettering
  0 siblings, 0 replies; only message in thread
From: Brett 'Bunny Killer' Kettering @ 1989-12-22 16:19 UTC (permalink / raw)


My question has to do with any run-time cost involved in instantiating
a procedure within the scope of a procedure exported by a package.

As an example consider solving the problem in two different manners.  A
procedure AAA is exported by a package (that is that the procedure is
one of those specified in the package specification.

---------
METHOD A:
---------

	X	: INTERNAL_X_TYPE;

	procedure AAA	(
			P1	: in P1_TYPE;
			P2	: out P2_TYPE;
			P3	: out P3_TYPE ) is

		procedure USED_BY_BBB( ELEMENT : in ELEMENT_TYPE ) is

		begin
			P2 := ELEMENT.P2;
			P3 := ELEMENT.P3;

		end USED_BY_BBB;

		procedure MY_BBB is
			new XXX.BBB( USED_BY_BBB );

	begin
		MY_BBB( X, P1 );

	end AAA;

---------
METHOD B:
---------

	X		: INTERNAL_X_TYPE;
	GLOBAL_P2	: P2_TYPE;
	GLOBAL_P3	: P3_TYPE;

	procedure USED_BY_BBB( ELEMENT : in ELEMENT_TYPE ) is

	begin
		GLOBAL_P2 := ELEMENT.P2;
		GLOBAL_P3 := ELEMENT.P3;

	end USED_BY_BBB;

	procedure MY_BBB is
		new XXX.BBB( USED_BY_BBB );

	procedure AAA	(
			P1	: in P1_TYPE;
			P2	: out P2_TYPE;
			P3	: out P3_TYPE ) is

	begin
		MY_BBB( X, P1 );
		P2 := GLOBAL_P2;
		P3 := GLOBAL_P3;

	end AAA;

I cannot find any mention in the LRM or any other reference that I have
about the run-time costs involved in solving the problem by either of these
manners.

Does anyone have any words of wisdom?  I would prefer the solution by
method A, but I need to limit the run-time cost as my procedure AAA will
be called often.

Brett Kettering
KETTERING%AMSTEL@ICDC.llnl.gov

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1989-12-22 16:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1989-12-22 16:19 Instantiation of a generic with a procedure's scope Brett 'Bunny Killer' Kettering

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