Page 1 of 1

Another clarification about local names

Posted: Thu Sep 05, 2019 9:41 pm
by kevinhely
Hi again,

The language definition states:
The use of the procedure identifier in a call within its declaration implies recursive activation of the
procedure.
That would seem to rule this out as legitimate code:

Code: Select all

PROCEDURE P;
    PROCEDURE P; END P; (*local*)
BEGIN P (*which P does this refer to?*)
END P;
(In earler times, the local declaration would have 'hidden' the name of the outer procedure.)
Do you agree? (I won't keep posting questions like this!)

Regards

Re: Another clarification about local names

Posted: Fri Sep 06, 2019 12:12 pm
by cfbsoftware
The outer P (a global object) would still be hidden by the inner P (a local object) wouldn't it?

Re: Another clarification about local names

Posted: Fri Sep 06, 2019 4:26 pm
by kevinhely
I would have thought so but it contradicts the quoted statement.

Re: Another clarification about local names

Posted: Sat Oct 31, 2020 9:38 pm
by augustk
We could also conclude that it is undefined which procedure is called. In practice, using the same name for a local procedure would only be confusing.