[Oberon] Procedure variables and local procedures

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Thu Sep 28 18:57:34 CEST 2017


Addendum: Another way to read the sentence “P must not be declared local to ANOTHER procedure” is that in fact “P may be declared local to the SAME procedure”. This is the case in the example below. Either way, the assignment to procedure variables is not restricted to globally defined procedures.
AP

On 28 Sep 2017, at 18:11, Andreas Pirklbauer <andreas_pirklbauer at yahoo.com> wrote:
> 
> Note that even though the Oberon language report of Oberon-07 still states that “If a procedure P is assigned to a procedure variable of type T [...]. P must not be declared local to another procedure”, in the current implementation of Oberon-07, this restriction is not actually checked - at least not in the case when the procedure variable to which a local procedure is assigned is itself declared locally in the same scope, as in the following example:
> 
>     MODULE M;
> 
>     PROCEDURE P;
>       VAR p: PROCEDURE;
>       PROCEDURE Q; BEGIN END Q;
>     BEGIN p := Q
>     END P;
>   END M.
> 
> which compiles correctly under Oberon 2013 without an error message.
> AP
> --------------------------------------------------------------------------
> August Karlstrom fusionfile at gmail.com <mailto:fusionfile at gmail.com> Thu Sep 18 12:14:29 CEST 2017
> In the latest revision of the Oberon language, access to identifiers in 
> intermediate scopes is denied. Doesn't this imply that the restriction 
> that only globally defined procedures can be assigned to procedure 
> variables, is the unnecessary?
> 
> -- August
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20170928/8eed0aaf/attachment.html>


More information about the Oberon mailing list