At 12:44 PM 11/26/98 +0100, Mats Weber wrote: >Could you please give an example of that (determination of the generic >actual subprogram cannot be done at compile time) ? As I said, at compile time you can determine which text will be designated, but that textual declaration can result in many instances of the subprogram which are callable from that point at run-time. If you worked with some PL/I implementations, think of it in terms of fat pointers. (A fat pointer has a pointer to the executable code, and also to the context--stack frame plus static pointer--for a particular instance of that subprogram.) You can determine the code pointer at compile time, but the stack pointer part must be filled in at run-time. Only it is a little more complex than that. In general it is the context pointer for the stack frame containing the instance that must be determined, during the call you create a new instance which uses that context. (Most compilers today don't use static pointers, they store the code and static pointers at a designated (often negative) offset from the stack pointer.) If you want to make up a test program and try it out, what you want to do is to have a generic formal subprogram with fewer parameters than the actual it matches. (This is not the only case, just the easiest to understand.) Now instantiate the generic in places where the visible subprogram or subprograms matching the generic formal have different default values for the "missing" parameters. As I said, the compiler can figure out at compile time which subprogram will be called, but the default values have to be picked up at run-time. They could even be entered from the terminal if you wish. More complex examples involve--again staying within Ada 83--things like having address values in the context of one of the subprograms, and having an address clause inside the actual subprogram, which uses that value. (I've used this in Ada 83 to get run-time polymorphism.) Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...