Lawrie Schonfelder wrote:
>
> In fact, I can see no good reason why the scope of a construct name should not
> be restricted to that of the construct in which it is defined. The name could
> then be reused within the same program unit to name similar but
> disjoint constructs; something that you very often produce by editing and
> repeating code.
>
Just a possibility - maybe the reason reuse of that kind is not allowed is because
of GOTO. For example:
A: do
...
if (COND1) exit A
end do
... intervening stuff
do
...intervening stuff
if (COND2) goto A
I realize GOTO is "bad", but as it is not illegal, you have to allow for this
situation. If A were allowed to be redefined, then the "target" of the GOTO would
be ambiguous.
Even not using GOTO, I could imagine something like this:
A: do
...
if (COND) cycle A
do
...
end do
end do
if (COND) cycle A ! Start the loop...?
Actually I'm not even sure this is legal. But if it is :-), then allowing the user
to redefine A: after the construct would cause ambiguity. Labels are used for
tricky logic that doesn't necessarily stay within constructs; I conjecture this is
the reason for the restriction.
Alvaro Fernandez
Rice University
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|