[comp.lang.ada] Instantiation of a generic with a procedure's scope

KETTERING@amstel.llnl.gov (Brett 'Bunny Killer' Kettering) (12/23/89)

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