[Oberon] CASE without ELSE

Josef Templ josef.templ at gmail.com
Fri Feb 16 10:42:41 CET 2018

The latest Oberon language definition by NW that I have found is Revision
1.10.2013 / 3.5.2016
(see http://people.inf.ethz.ch/wirth/Oberon/Oberon07.Report.pdf).

It does have a numeric CASE statement.

My interpretation of what might have happened is this:
In Oberon07 the numeric CASE had been dropped, but later it has been
but the ELSE has been forgotten.
To me, a numeric CASE without an ELSE is pointless.
The compiler needs to emit a range check anyway for generating a TRAP if
there is no ELSE.
The ELSE part comes (almost) for free.
If the ELSE check is done outside the CASE, it is actually done twice.

In contrast to some postings, by the way, the labels are not forced to
start with 0
and they can also be negative (by specifying a negative named constant).
In a real implementation, it would be much simpler to allow any ConstantExpr
of appropriate result type, though.

My conclusion so far is: If the numeric CASE is not implemented but only
it should not be taken literally.

- Josef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20180216/3c7bdd5d/attachment.html>

More information about the Oberon mailing list