[Oberon] Alternatives for cases.
andreas_pirklbauer at yahoo.com
Sun Mar 10 10:29:55 CET 2019
> Fortunately there is no need to bother when using the complete
> implementation of Oberon-07 - the existing CASE statement already
> satisfies my needs. I was merely using the SET example to emphasise
> the difference between the capabilities of IF-THEN-ELSE and CASE
> for the benefit of those who believe they are equivalent.
Point taken. Perhaps you can write a paper entitled “The case for the
CASE statement” or something, laying out some real use cases and
describing the benefits of the CASE statements for those (apart from
- compare a value against one or more values of the same type
- respond to multiple potential values in a single case
- check a value for inclusion in an interval (interval matching)
- no implicit fallthrough
and perhaps describing potential extensions, e.g. instead of simply
matching for integer, char or byte values, match for more complex
matching patterns such as regular expressions.
More information about the Oberon