[Oberon] PO 2013 allows one to "override" predefined procedures and functions
Andreas Pirklbauer
andreas_pirklbauer at yahoo.com
Sat May 29 09:31:29 CEST 2021
It depends on the system:
a) In PO2013/Oberon-07, the scope rules in ch.4 of the language report
state that “the scope extends textually from the point of the declaration
to the end of the block (procedure or module) to which the declaration
belongs and hence to which the object is local. example
b) In A2/Active Oberon, the scope rules in ch.3 of its language report
state that “the scope of an item x is the smallest (w.r.t. nesting) block
(module, procedure, record or object) in which it is declared.
The item is local to this scope. Scope rules are:
1. No identifier may denote more than one item within a given scope.
2. An item may be directly referenced within its scope only.
3. The order of declaration within a scope does not affect the
meaning of a program.
By “should?” I meant “what is a sensible choice?”. I can certainly live
with both definitions a) and b) above. To the best of my knowledge,
definition a) has been used in most implementations since Pascal
days (as it is easy to implement in single pass compilers),
but b) appears equally valid.
-ap
> Is there a specific part of the Oberon Language report that prompts
> you to ask this question? If not, why should it not be allowed?
>
> Regards,
> Chris Burrows
> CFB Software
> https://www.astrobe.com
>
>
> > On Sat, May 29, 2021 at 12:23 PM Andreas Pirklbauer wrote:
> >
> > By contrast, should the following be allowed?
> >
> > MODULE M;
> >
> > VAR ch: CHAR;
> > CHAR: INTEGER; (*this is allowed in PO 2013*)
> >
> > BEGIN CHAR := 1
> > END M.
> >
> > -ap
> >
More information about the Oberon
mailing list