[Oberon] Procedure variables and local procedures

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Fri Sep 29 21:52:14 CEST 2017


> On Fri Sep 29 at 20:18:04 CEST Claudio Nieder wrote:
> 
> If this my understanding is correct, then the question
> which arises is, why are there still local procedures?
> In my eyes nested procedures seem to make only
> sense to facilitate the access to intermediate
> variables. Eliminating access to intermediate
> variables them to make stuff simple you
> should also remove nested procedures.
> 
> claudio

One may argue about that. The answers usually given are along the following lines:

1. Sometimes it is desirable to nest a procedure to indicate that it is called only from the enclosing procedure.

2. Adding local procedures to the language comes practically for free, so long as access to intermediate variables is not a requirement. In that case, it simply does not make anything more complicated.

3. The desire to keep the language specification unchanged (note that the restriction introduced with Oberon-07 had no impact on the language definition, as the question of which variables can be accessed is left open in the language report).

Personally, as an application programmer I am indifferent, as a very rarely use local procedures - only when reason #1 appears appealing enough in a particular situation. But other programmers may have different criteria or preferences.

As a compiler implementor I do care a lot about whether access to intermediate variables needs to be provided or not. But once it has been decided that one does *not* have to implement this feature (as is the case in Oberon-07), I am again indifferent. It just makes no difference to the compiler in that case.

But as Paul said earlier in this discussion, to a certain degree it's a matter of taste.

--AP

.


More information about the Oberon mailing list