[Oberon] Intermediate scopes in Oberon-07
Andreas Pirklbauer
andreas_pirklbauer at yahoo.com
Sat Feb 10 07:41:47 CET 2018
> From: Chris Burrows chris at cfbsoftware.com Sat Feb 10 01:28:16 CET 2018
>
> The PO2013 system consists of a total of approximately 850 procedures.
> I could only find 17 that were local procedures. Of those 17 I couldn’t
> find a single example where the enclosing procedure had a TYPE or CONST
> declaration. That did not surprise me at all.
Interesting statistics. This means that it should be “safe" to change
the implementation of the language, such that access to intermediate types
and constants is no longer allowed.
> However, when I looked a bit further, what did come as a surprise
> was that I could find only ONE local TYPE declaration and only eight
> local CONST declarations (5 of those in Math.Mod) in the entire system
>
> If these sorts of statistics were common to other current real world
> Oberon applications it would be reasonable to ask whether not only
> local PROCEDUREs, but also local TYPEs, are really *needed*.
This would leave us with a language that only has *global* procedures
and within these global procedures all one can have is local *variables*.
i.e. no more local types, local constants or local (nested) procedures.
A welcome side effect would be a(n even) simpler compiler.
However, I don’t know whether these sorts of statistics is indeed
common to other current "real world" Oberon applications. I did a
quick check for the Oberon System 3 (ETH Oberon), Oberon V4 (Linz
Oberon) and ETH A2 (formerly AOS) systems. At least in those systems,
local TYPE and CONST declarations seem to be very rarely used indeed.
There are, however, local procedures, in use, just like in PO2013,
but not too many. These could certainly be converted to global ones.
> All of these features were *absolutely essential* in the Pascal
> days when all you had was a single PROGRAM file. But since the
> introduction of MODULEs in Modula-2 and the simplification of
> TYPEs in Oberon they have become less and less significant
Exactly right. One could say that since Modula-2 the module has
become the primary information hiding mechanism.
> ... or would that be a case of making it simpler
> than "as simple as possible”?
This is another one of those questions that can be debated endlessly.
I would only argue for consistency across the board, e.g.,
1. *If* local procedures are kept in the language, *then* one might as
well keep local types and constants (as is currently the case in PO13)
2. *If* access to intermediate *variables* (i.e. variables declared
in an enclosing procedure scope) is not allowed in the language (as
is the case since the Oberon-07 revision), *the*n one should probably
also not allow access to intermediate types and constants (this is
where Oberon-07 is inconsistent at the moment).
Again, I had suggested to eliminate local procedures altogether in
the past - now that access to intermediate *variables* is no longer
possible (since the Oberon-07 language revision). But it was decided
to *keep* local procedures in the language.
Regards,
Andreas
> Regards,
> Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20180210/d52deabd/attachment.html>
More information about the Oberon
mailing list