Hi,
> The whole point of an internal procedure is that it is only visible to
> its host.
I disagree. I think the major point is that this procedure has acess to all
the *current* variables in the host program unit, not that it is only
visible inside the host unit.
> Can you think of a situation where you would like to pass an
> internal procedure but it would be inconvenient [better say *impossible*]
> to pass a module procedure?
Yes, of course, otherwise I wouldn't be asking. What concerns me is reverse
communication mechanisms using internal procedures (someone mentioned this
on this list). It is too complicated to illustrate this with an example
right here.
The major difference between sharing variables via a module and sharing them
via host association related to this example is that if the host is a
procedure its arguments are visible to the internal procedure, even though
they are not passed to it--and this is a dynamic association which can not
be emulated with module variables which are in a sense static and have only
one copy (imagine several concurrent copies of the host procedure running).
I am not sure how compilers actually implement this, so I can not for sure
say if passing an internal procedure as an actual is at all possible with
dynamic allocation (stack-based).
Thanks,
Aleksandar
|