CASE in Project Oberon, Revised Oberon
Hi all, Is there a clear statement of amendments to CASE in Project Oberon? As far as I can tell: - Pointers and records can be used in expression position, providing type-switch behaviour (example in TextFrames.Handle); type identifiers are therefore accepted in label position. - INTEGER and CHAR cases aren't implemented yet ("numeric case not implemented") but will be in a future release. Related question: can anyone explain the motivation for CASE simplifications in Revised Oberon ('07)? In "Differences between Revised Oberon and Oberon," Prof. Wirth writes: The case statement performs the same function as the if statement. However, it is intended to use a different technique of implementation, namely a single, indexed branch instead of a cascade of conditional branches. This is sensible only if the cases are distinguished by a (mostly) contiguous range of label values. 1. Labels are integers or character constants. 2. Labels form a range of values, starting with 0, like array indices. My concern is that -- given the change to label ranges outlined above and the removal of the default (ELSE) clause -- implementational simplicity and efficiency have trumped expressiveness, limiting the utility of CASE. Thanks, Marc
participants (1)
-
Marc Simpson