[Oberon] PO 2013 allows one to "override" predefined procedures and functions

Josef Templ josef.templ at gmail.com
Sat May 15 16:23:39 CEST 2021


Standard procedures in Oberon live in the outmost (global) scope on purpose
and the reason is extensibility. It makes it possible to add new procedures
later without invalidating any existing programs. This is so in all Pascal
style languages and their successors. It is very cheap to implement in the
compiler and fits well with the nesting of scopes. Overriding such
procedures locally is thereby possible but used mainly when a new procedure
happens to be added in a new language version or dialect and an object with
the same name already exists in a program. The locally defined name then
shadows the same name in the global scope and the program compiles and runs
as before.

I would not recommend to remove this feature.

- Josef

<oberon-request at lists.inf.ethz.ch> schrieb am Sa., 15. Mai 2021, 12:00:

> Send Oberon mailing list submissions to
>         oberon at lists.inf.ethz.ch
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.inf.ethz.ch/mailman/listinfo/oberon
> or, via email, send a message with subject or body 'help' to
>         oberon-request at lists.inf.ethz.ch
>
> You can reach the person managing the list at
>         oberon-owner at lists.inf.ethz.ch
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Oberon digest..."
>
>
> Today's Topics:
>
>    1. PO 2013 allows one to "override" predefined procedures and
>       functions (Andreas Pirklbauer)
>    2. Re: [EXT] PO 2013 allows one to "override" predefined
>       procedures and functions (Skulski, Wojciech)
>    3. PO 2013 allows one to "override" predefined procedures and
>       functions (Andreas Pirklbauer)
>    4. Re:  PO 2013 allows one to "override" predefined procedures
>       and functions (Diego Sardina)
>    5. Re: PO 2013 allows one to "override" predefined procedures
>       and functions (J?rg)
>    6. RiskOne ordered (Skulski, Wojciech)
>    7. Re: RiskOne ordered (peter at easthope.ca)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 14 May 2021 15:29:21 +0200
> From: Andreas Pirklbauer <andreas_pirklbauer at yahoo.com>
> To: Oberon List <oberon at lists.inf.ethz.ch>
> Subject: [Oberon] PO 2013 allows one to "override" predefined
>         procedures and functions
> Message-ID: <7012460B-DB79-4945-BA61-8FD9CF5603E3 at yahoo.com>
> Content-Type: text/plain; charset=utf-8
>
> Has anyone noticed that the PO 2013 allows the programmer
> to ?overrride? predefined procedures and functions, e.g.,
>
>   MODULE M;
>     VAR
>        INC: CHAR;
>        i: INTEGER;
>   BEGIN
>     INC := "a?;
>     INC(i)           (*not a procedure*)
>   END M.
>
> This should not be allowed..
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Fri, 14 May 2021 14:00:35 +0000
> From: "Skulski, Wojciech" <skulski at pas.rochester.edu>
> To: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
> Subject: Re: [Oberon] [EXT] PO 2013 allows one to "override"
>         predefined procedures and functions
> Message-ID:
>         <
> SN6PR07MB41575CDB194A6063310CA849FF509 at SN6PR07MB4157.namprd07.prod.outlook.com
> >
>
> Content-Type: text/plain; charset="Windows-1252"
>
> Andreas:
>
> what a great feature. It could be really useful in the hands of a creative
> programmer. I am wondering, what would be the run time behavior of this
> feature. A crash?
>
> How did you find this feature? Would be good to get rid of it.
>
> Wojtek
> ________________________________________
> From: Oberon [oberon-bounces at lists.inf.ethz.ch] on behalf of Andreas
> Pirklbauer [andreas_pirklbauer at yahoo.com]
> Sent: Friday, May 14, 2021 9:29 AM
> To: Oberon List
> Subject: [EXT] [Oberon] PO 2013 allows one to "override" predefined
> procedures and functions
>
> Has anyone noticed that the PO 2013 allows the programmer
> to ?overrride? predefined procedures and functions, e.g.,
>
>   MODULE M;
>     VAR
>        INC: CHAR;
>        i: INTEGER;
>   BEGIN
>     INC := "a?;
>     INC(i)           (*not a procedure*)
>   END M.
>
> This should not be allowed..
>
>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.inf.ethz.ch_mailman_listinfo_oberon&d=DwIGaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=uUiA_zLpwaGJIlq-_BM9w1wVOuyqPwHi3XzJRa-ybV0&m=aquER2B_iMTCPcBNn8atuDabRu9Ug4b-gwKWYBDLcuY&s=iCC8WHsYTs9T-Z3WIsqaiI6kRLCbx6Qv8lCYDfs_Ddk&e=
>
>
> ------------------------------
>
> Message: 3
> Date: Fri, 14 May 2021 16:19:46 +0200
> From: Andreas Pirklbauer <andreas_pirklbauer at yahoo.com>
> To: Oberon List <oberon at lists.inf.ethz.ch>
> Subject: [Oberon] PO 2013 allows one to "override" predefined
>         procedures and functions
> Message-ID: <B0FC842A-6CDA-40F8-A607-3A529EFFC203 at yahoo.com>
> Content-Type: text/plain; charset=utf-8
>
> Wojtek,
>
> The run time behaviour of this ?feature? is to simply override the
> predefined identifier, which then is
> no longer available in the current scope. So no crash. One can even
> override things like INTEGER, etc.
>
> Actually, the compiler itself does some overriding in this way, namely
> with the three procedures
> ORG.ADC, ORG.SBC, ORB.UML. Inside these three procedures the corresponding
> predefined
> identifier (ADC, SBC or UML) is of course not available.
>
> To disallow this kind of ?overrriding? in the compiler, one could for
> example:
>
> 1. Rename ORG.ADC, ORG.SBC, ORB.UML to ORG.Adc, ORG.Sbc, ORB.Uml
>
> 2. Adapt ORP.StandFunc accordingly to use the new procedure names
>
> 3. Adapt ORB.NewObj such that it now also checks the predefined
> identifiers as follows:
>
>     x := universe;
>     WHILE (x # NIL) & (x.name # id) DO x := x.next END ;
>     IF x = NIL THEN (*...ok...*) ELSE ORS.Mark("predefined identifier?) END
>
> to arrive at something along the lines of:
>
>   PROCEDURE NewObj*(VAR obj: Object; id: ORS.Ident; class: INTEGER);
> (*insert new Object with name id*)
>     VAR new, x: Object;
>   BEGIN x := universe.next;
>     WHILE (x # NIL) & (x.name # id) DO x := x.next END ;
>     IF x = NIL THEN x := topScope;
>       WHILE (x.next # NIL) & (x.next.name # id) DO x := x.next END ;
>       IF x.next = NIL THEN
>         NEW(new); new.name := id; new.class := class; new.next := NIL;
> new.rdo := FALSE; new.dsc := NIL;
>         x.next := new; obj := new
>       ELSE obj := x.next; ORS.Mark("mult def")
>       END
>     ELSE ORS.Mark("predefined identifier")
>     END
>   END NewObj;
>
> PS: When doing this, the impact on the compiler?s performance is about
> 5-10%.
>
> -ap
>
>
> > Andreas:
> >
> > what a great feature. It could be really useful in the hands of a
> creative programmer. I am wondering, what would be the run time behavior of
> this feature. A crash?
> >
> > How did you find this feature? Would be good to get rid of it.
> >
> > Wojtek
> ________________________________________
> From: Oberon [
> oberon-bounces at lists.inf.ethz.ch] on behalf of Andreas Pirklbauer
> [andreas_pirklbauer at yahoo.com
> ]
> Sent: Friday, May 14, 2021 9:29 AM
> To: Oberon List
> Subject: [EXT] [Oberon] PO 2013 allows one to "override" predefined
> procedures and functions
>
> Has anyone noticed that the PO 2013 allows the programmer
> to ?overrride? predefined procedures and functions, e.g.,
>
>   MODULE M;
>     VAR
>        INC: CHAR;
>        i: INTEGER;
>   BEGIN
>     INC := "a?;
>     INC(i)           (*not a procedure*)
>   END M.
>
> This should not be allowed..
>
> ------------------------------
>
> Message: 4
> Date: Fri, 14 May 2021 16:14:16 +0200
> From: "Diego Sardina" <dsar at eml.cc>
> To: oberon at lists.inf.ethz.ch
> Subject: Re: [Oberon]  PO 2013 allows one to "override" predefined
>         procedures and functions
> Message-ID: <abd70680-9ba8-4a38-9e4e-ba426b8757e3 at www.fastmail.com>
> Content-Type: text/plain;charset=utf-8
>
> On Fri, May 14, 2021, at 3:29 PM, Andreas Pirklbauer wrote:
> > Has anyone noticed that the PO 2013 allows the programmer
> > to ?overrride? predefined procedures and functions, e.g.,
> >
> >   MODULE M;
> >     VAR
> >        INC: CHAR;
> >        i: INTEGER;
> >   BEGIN
> >     INC := "a?;
> >     INC(i)           (*not a procedure*)
> >   END M.
> >
> > This should not be allowed..
> >
>
> For what I remember in Oberon every predefined identifier can be
> overridden since always.
>
> This is the reason TRUE and FALSE were promoted to keyword in Oberon-07,
> to avoid CONST TRUE = FALSE.
>
> But I agree that this shouldn't be allowed (and that promotion to keyword
> is debatable).
>
> --
> Diego Sardina
>
>
> ------------------------------
>
> Message: 5
> Date: Fri, 14 May 2021 16:25:11 +0200
> From: J?rg <joerg.straube at iaeth.ch>
> To: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
> Subject: Re: [Oberon] PO 2013 allows one to "override" predefined
>         procedures and functions
> Message-ID: <175B9254-7AF3-48FE-AE31-BB0C41459FB6 at iaeth.ch>
> Content-Type: text/plain; charset=utf-8
>
>
>
> Gruss, J?rg
>
> > Am 14.05.2021 um 16:23 schrieb Diego Sardina <dsar at eml.cc>:
> >
> > ?On Fri, May 14, 2021, at 3:29 PM, Andreas Pirklbauer wrote:
> >> Has anyone noticed that the PO 2013 allows the programmer
> >> to ?overrride? predefined procedures and functions, e.g.,
> >>
> >>  MODULE M;
> >>    VAR
> >>       INC: CHAR;
> >>       i: INTEGER;
> >>  BEGIN
> >>    INC := "a?;
> >>    INC(i)           (*not a procedure*)
> >>  END M.
> >>
> >> This should not be allowed..
> >>
> >
> > For what I remember in Oberon every predefined identifier can be
> overridden since always.
> >
> > This is the reason TRUE and FALSE were promoted to keyword in Oberon-07,
> to avoid CONST TRUE = FALSE.
> >
> > But I agree that this shouldn't be allowed (and that promotion to
> keyword is debatable).
> >
> > --
> > Diego Sardina
> > --
> > Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> > https://lists.inf.ethz.ch/mailman/listinfo/oberon
>
>
> ------------------------------
>
> Message: 6
> Date: Fri, 14 May 2021 15:28:14 +0000
> From: "Skulski, Wojciech" <skulski at pas.rochester.edu>
> To: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
> Subject: [Oberon] RiskOne ordered
> Message-ID:
>         <
> SN6PR07MB4157574B3A984FAADF19B383FF509 at SN6PR07MB4157.namprd07.prod.outlook.com
> >
>
> Content-Type: text/plain; charset="us-ascii"
>
> All:
>
>   I ordered production of two prototype RiskOne motherboards. If anyone
> want to have those, it is the last minute to tell me so I can possibly add
> more boards to the order. You need to do it today. The cost will be $500
> per board.
>
> The features:
> Spartan-6 LX25,
> 4 MB of ZBT RAM,
> 16 MB HyperRAM (so it is 20 MB total). I intend to use HyperRAM for video,
> but it can be used for anything else.
> HDMI connector to output video
> PS2 mouse and keyboard
> W5500 chip for Ethernet with the RJ-45 socket.
> Three serial ports. One of these can be optionally operated as "optical
> interface" at 50 MHz.
> Connector for the Nordic NRF24L01 radio, same as PO 2013.
> Connector for Wi-Fi Sparkfun WRL-13678.
> Two SD cards. One micro, one full. This is to adopt Chris file system
> HCFiler with one of these.
> Three PMOD connectors.
> One set of expansion connectors for the daughter card "shield".
>   -- I already designed the ADC shield, which is my primary interest.
>   -- The shield can be anything: ADC, DAC, industrial PID control,
> anything.
>
> I would have attached the full spec sheet, but this will hold off the
> posting for approval.
>
>
>
> ------------------------------
>
> Message: 7
> Date: Fri, 14 May 2021 10:17:11 -0700
> From: peter at easthope.ca
> To: oberon at lists.inf.ethz.ch
> Subject: Re: [Oberon] RiskOne ordered
> Message-ID: <E1lhbR1-0001Dh-8B at joule.invalid>
>
> Hi Wojciech,
>
> > I ordered production of two prototype RiskOne motherboards. If
> > anyone want to have those, it is the last minute to tell me so I can
> > possibly add more boards to the order. You need to do it today. The
> > cost will be $500 per board.
>
> Good news.  I thought of asking about progress but better to refrain
> from bothering you.
>
> Please order one at my expense.  No rush to receive it.  As described
> earlier, it's an investment.  Can convert 500 US to Canadian dollars
> and mail a paper cheque to your campus address.  Is Interac used
> there?  Might be Canada only.  World Remit is international and I use
> it routinely.  If you prefer another means of payment, just let me
> know.
>
> Thanks!                              ... P.
>
> --
> tel: +1 604 670 0140            Bcc: peter at easthope. ca
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>
>
> ------------------------------
>
> End of Oberon Digest, Vol 204, Issue 11
> ***************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20210515/fa2c4b4f/attachment.html>


More information about the Oberon mailing list