[Oberon] Numerical CASE Statements in Project Oberon

John Stout JSS at kgv.ac.uk
Tue Nov 10 14:23:43 CET 2015


I wonder what Professor Wirth's views might be on this.

>From the book The School of Niklaus Wirth (>> The Art of Simplicity<<) ISBN 1-55860-723-4, the chapter by Michael Franz called Oberon - The Overlooked Jewel:

"I still vividly remember the day that With decided to replace the elegant data structure used in the compiler's symbol table handler by a mundane linear list. In the original compiler, the objects in the symbol table had been sorted in a tree data structure (in identifier lexical order) for fast access, with a separate linear list representing their declaration order. One day Wirth decided that there really weren't enough objects in a typical scope to make the sorted tree cost-effective. All of us Ph.D. students were horrified: it had taken time to implement the sorted tree, the solution was elegant, and it worked well - so why would one want to throw it away  and replace it with something simpler, and even worse, something as prosaic as a linear list? But of course, Wirth was right, and the simplified compiler was both smaller and faster than its predecessor."

The implementation using IF ... THEN chains is simple. If the most common cases are positioned first in the chain then the execution time for these cases is minimised. The compiler will be simpler, the implementation of the ELSE (or an error) is simple to implement and the compiler will be simple and fast.

Looking through the body of Oberon code that we have what is the distribution of the number of cases? I realise we are talking about a new feature, but I still favour the simple solution, in keeping with the spirit of Oberon.

John Stout

[King George V Logo]
John Stout
Management Information Systems Coordinator
Tel: 01704 530601
E-Mail: JSS at kgv.ac.uk
Web: www.kgv.ac.uk


Information contained in this e-mail is intended for the use of the addressee only and is confidential.  Any dissemination, distribution, copying or use of this communication without prior permission of the addresseeis strictly prohibited.

Every effort has been made to ensure that any attachment to this mail does not contain virus. King George V College has taken every reasonable precaution to minimise this risk, neither it nor the sender can accept liability for any damage which you sustain as a result of software viruses. You should carry outyour own virus checks before opening any attachments.

[Think Before You Print]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20151110/a8cf7adb/attachment.html>


More information about the Oberon mailing list