[Oberon] Non-matching expressions in case statements
August Karlstrom
fusionfile at gmail.com
Tue Aug 29 16:52:11 CEST 2023
1) For case statements with integer labels, which often represent an
enumerated type, it's *desirable* to trap non-matching case expressions
as it may indicate a forgotten case label.
2) When using case statements with type labels, the programmer typically
relies on non-matching case expressions being ignored; for message
records the message "fall through", as described in "Programming in
Oberon", p. 61. Here it's *essential* that the implementation does not
halt the program with a trap, otherwise this technique will not work.
The language report says:
"First the case expression is evaluated, then the statement sequence is
executed whose case label list contains the obtained value."
As I interpret the sentence above, the expression is supposed to match
exactly one label, however that is not the case with "fall through"
messages. I think it needs to be clarified in the language report that
"fall through" is well-defined for case statements with type labels. Any
comments?
https://people.inf.ethz.ch/wirth/Oberon/PIO.pdf
https://miasap.se/obnc/oberon-report.html#sec6.3
Regards,
August
More information about the Oberon
mailing list