Procedure variables and local procedures
-----Original Message----- From: Chris Burrows [mailto:chris at cfbsoftware.com] on Sunday, 1 October 2017 9:52 AM
In the original Oberon, NW defined in the low level compiler module SYSTEM the procedure NEW(v, n). In Oberon-07 this is not existing anymore. As Andreas Pirklbauer demonstrated, this functionality can be introduced with Oberon-07 > without changing the language.
Not exactly. Oberon-07 doesn't allow ARRAY OF <type> in a type or variable declaration (excluding open array parameters which are a different concept). Nor does Oberon-07 allow POINTER TO ARRAY - pointers can only point to RECORDS (which can have ARRAYs as fields). If these syntax changes were introduced they would need to be considered as language extensions. There would also be the question of whether the feature would be restricted to single-dimensional arrays, what notation would be used if multi-dimensional arrays would be used, how many dimensions would be allowed, what are the rules of assignment compatibility issues etc. I have seen various Oberon-style implementations of this over the years e.g.
It would be fairly easy to add any of the features mentioned above (e.g. POINTER TO ARRAY, multi-dimensional arrays) to the solution outlined in http://www.github.com/andreaspirklbauer/Oberon-generic-heap-allocation , but that is the one thing I did *not* want to do: extend the language itself. It can of course be done, but one should note that one can always just create a record that then contains any data structure one needs. The downside is that it introduces one additional field in the code, e.g. you write ptr.a[3] instead of ptr[3], where ptr is a POINTER TO R, and R is a RECORD a: ARRAY OF <type> END, making it a little less natural to read. Just my two (Swiss) Rappen.. -AP
Andreas Pirklbauer [andreas_pirklbauer@yahoo.com] wrote:
one thing I did *not* want to do: extend the language itself.
Resuscitate, rather than extend. (Wording is a matter of *my* taste.) IMHO, it would be beneficial to make the language more powerful and more useful. All the features discussed in this thread were once present, being used, and found very useful in the real production. If there is a question whether the resuscitated/extended compiler can run in 1 meg of RAM, then perhaps we need two languages running on the same run time core which is IMHO outstanding. The smaller compiler could fit into 1 meg, while the larger compiler would need more megs. The smaller one can be used for teaching, while the larger one would be more productive in real development. Please note that NW defined Oberon-0, wrote a book, and made a compiler for it. He did this for teaching. Even he himself did not argue that Oberon-0 is a production language. We can take his own approach. Let Oberon-0 be geared for undergraduate courses, Oberon-07 for more advanced courses as well as some limited production, and let Oberon-2 and Component Pascal be available for serious work. Just my two zlotys. W.
Read what NW wrote recently: 20170528 - Oberon0 - Compiler Construction To the Oberon0 compiler in the book Compiler Construction is attached an elulator for RISC5. Since now an efficient emulator is available, and also a hardware RISC5 on an FPGA board, it no longer makes sense to run a RISC-emulator on a RISC processor. I have therefore changed the compiler to generate code in the format of the regular Oberon loader. The language Oberon0 (subset of Oberon) remains unchanged, except for some I/O predefined procedures. Changes are printed in red in the book. OSP.Mod, OSG.Mod, OSS.Mod, TestOberon0.Mod https://www.inf.ethz.ch/personal/wirth/news.txt Pablo Cayuela Argentina El oct. 1, 2017 10:37, "Skulski, Wojciech" <skulski@pas.rochester.edu> escribió:
Andreas Pirklbauer [andreas_pirklbauer@yahoo.com] wrote:
one thing I did *not* want to do: extend the language itself.
Resuscitate, rather than extend. (Wording is a matter of *my* taste.)
IMHO, it would be beneficial to make the language more powerful and more useful. All the features discussed in this thread were once present, being used, and found very useful in the real production.
If there is a question whether the resuscitated/extended compiler can run in 1 meg of RAM, then perhaps we need two languages running on the same run time core which is IMHO outstanding. The smaller compiler could fit into 1 meg, while the larger compiler would need more megs. The smaller one can be used for teaching, while the larger one would be more productive in real development.
Please note that NW defined Oberon-0, wrote a book, and made a compiler for it. He did this for teaching. Even he himself did not argue that Oberon-0 is a production language. We can take his own approach. Let Oberon-0 be geared for undergraduate courses, Oberon-07 for more advanced courses as well as some limited production, and let Oberon-2 and Component Pascal be available for serious work.
Just my two zlotys.
W.
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
participants (3)
-
Andreas Pirklbauer -
Pablo Cayuela -
Skulski, Wojciech