GDAU100@BGUVM.BITNET ("Jonathan B. Owen") (11/17/88)
I use generic packages quite extensivly. This does not mean I understand what code is generated out of the sources I write. This can be a problem when trying to consider code efficiency... What is performed in run-time each time the following is invoked: procedure GENERIC_QUESTION( name : string ) is subtype this_string_type is String(name'RANGE); package THIS_CRUNCH is new STRING_CRUNCH( this_string_type ); begin THIS_CRUNCH.STEP_ON_STRING( name ); end GENERIC_QUESTION; When is the code produced? My immediate guess, is that the package THIS_CRUNCH is creates ONCE for type "string" and not each time the procedure is invoked with a different string. Am I right? I came up with the above code while writing it, so don't try to make sense out of it. Also, I have not thought out if the above is necessary for creating a generic package for each subtype of type "string". What I do know, is that I have encountered the need to declare a subtype as a function of an unconstrained formal parameter. And then, with this subtype, declare an instantiation of a generic package. Thanks for any clarification, JB ______________________________________________________________________________ (--) /--) /-(\ Email: gdau100@bguvm (bitnet) \ / /--K | \|/\ /\/) /|-\ Snail: 55 Hovevei Zion _/_/o /L__)_/o \/\__/ \X/ \_/ | |_/ Tel-Aviv, 63346 ISRAEL (/ Jonathan B. Owen Voice: (03) 281-422 Point of view: A chicken is the means by which an egg reproduces an egg. ______________________________________________________________________________