[Oberon] CASE without ELSE

August Karlstrom fusionfile at gmail.com
Thu Feb 15 17:52:12 CET 2018


On 2018-02-15 16:12, Jörg wrote:
> The compiler doesn’t even implement the numeric case. 

If I understand it correctly, for integer and character case 
expressions, the case statement may trap unmatched expressions. This is 
beneficial when the expression is a variable of an enumerated type 
(semantically) since it implies that the statement should handle all 
cases. Unfortunately the compiler cannot enforce it.

> NW 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.

This is in line with Wirth's idea that no language construct should have 
hidden inefficiencies.


-- August


More information about the Oberon mailing list