Another clarification about local names

Topics related to the use of Oberon language features
Post Reply
kevinhely
Posts: 29
Joined: Wed May 18, 2011 3:35 am

Another clarification about local names

Post by kevinhely » Thu Sep 05, 2019 9:41 pm

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

cfbsoftware
Site Admin
Posts: 493
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Another clarification about local names

Post by cfbsoftware » Fri Sep 06, 2019 12:12 pm

The outer P (a global object) would still be hidden by the inner P (a local object) wouldn't it?

kevinhely
Posts: 29
Joined: Wed May 18, 2011 3:35 am

Re: Another clarification about local names

Post by kevinhely » Fri Sep 06, 2019 4:26 pm

I would have thought so but it contradicts the quoted statement.

augustk
Posts: 54
Joined: Mon Sep 05, 2011 5:21 pm
Location: Sweden

Re: Another clarification about local names

Post by augustk » Sat Oct 31, 2020 9:38 pm

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.

Post Reply