[Oberon] Intermediate scopes in Oberon-07

Jörg joerg.straube at iaeth.ch
Sat Feb 10 14:25:05 CET 2018


Hi all

In low layer modules, I like to declare local TYPEs in a procedure to redefine the TYPE of a parameter. Just as an example parameter is INTEGER, I would like to work with C4 = ARRAY 4 OF CHAR. Obviously, I could work on the parameter with pure SYSTEM.GETs but for the sake of the example let’s stick to C4 for a minute.

Now, as Oberon has no macros, I declare in my PROCEDURE with the local C4 another nested procedure as kind of writing shortcut in my procedure’s code.
Et voila, I‘m in the situation where the nested procedure should have access to the intermediately declared C4.

Would you accept this as a valid example for intermediate TYPEs?

Jörg

> Am 10.02.2018 um 13:16 schrieb Andreas Pirklbauer <andreas_pirklbauer at yahoo.com>:
> 
>   > That may be so but may also be irrelevant. I can't think of any genuine use
>   > for an intermediate TYPE if intermediate variables of that type are inaccessible. 
>   >
>   > Can you refer me to an existing real-world practical Oberon example where an
>   > intermediate type is accessed in a nested procedure?
>   >
>   > Chris
> 
> I can’t think of any! In a previous post I have provided an implementation that
> PO2013 makes the compiler consistent in the sense that ALL intermediate objects
> (constants, types, procedures) are now treated identically with respect
> to *access rights*, i.e. they cannot be accessed in a nested procedures.
> 
> A separate question is of course whether one should allow the ability to *declare*
> local types or constants at all - it makes of course sense to keep that possibility.
> 
> But if local procedures were *eliminated* from the language one day, then the whole
> access discussion goes away completely, since in that case intermediate objects (of
> any kind!) simply can no longer exist. There can only be (a) global objects or (b)
> objects that are local to (globally declared) procedures.
> 
> As I said, one can endlessly debate all this…
> 
> 
> 
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20180210/47afd9a4/attachment.html>


More information about the Oberon mailing list