> ...
>
> - Josef
Josef,
1. The numeric case, i.e. where the type T of the case expression (case variable) is of type INTEGER or CHAR, is not actually implemented in Oberon 2013. As a consequence, one now needs to use e.g. an IF statement instead.
2. Only the case where the type T of the case expression (case variable) is a RECORD or POINTER type is implemented in Oberon 2013. In this case, the case labels must be extensions of T. This is typically used in installed handler procedures in the Oberon viewer system - which now seems to have become the intended main use of CASE.
Now one can why there is no ELSE clause: If the type T of the case expression is a RECORD or POINTER type, the ELSE can always be simulated by simply specifying the *base* type of T as the *last* element in the case list.
.. as in MenuViewers.Handle:
CASE M OF
Oberon.InputMsg: ... | Oberon.ControlMsg: ... |
Oberon.CopyMsg: ... |
Display.FrameMsg: .. (*this is in fact the ELSE clause*)
END
One just needs to get the order right: extended types first, base type last (if one placed the base type at the beginning of the list, it would always evaluate to TRUE even if M were an extension of T)