[Oberon] CASE without ELSE

Jörg joerg.straube at iaeth.ch
Fri Feb 16 11:22:32 CET 2018


Instead of this

 

    CASE x OF

    0:

    | 2:

    | 10:

    ELSE

    END;

 

you could write more explicitly:

 

    CASE x OF

    0:

    | 2:

    | 10:

    | 1, 3..9:

    END;

 

br

Jörg

 

Von: Oberon <oberon-bounces at lists.inf.ethz.ch> im Auftrag von Andreas Pirklbauer <andreas_pirklbauer at yahoo.com>
Antworten an: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
Datum: Freitag, 16. Februar 2018 um 11:14
An: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
Betreff: [Oberon] CASE without ELSE

 



> My interpretation of what might have happened is this: > In Oberon07 the numeric CASE had been dropped, but later

> it has been reintroduced but the ELSE has been forgotten.



That’s one possibility. Another possibility would be that

it was dropped but the grammar was not fully restricted

to the non-numerical case, i.e. only the ELSE was removed

but not the fact that that case expression can an integer.



Either way, we now have a language spec that contains the

numerical case, but an implementation that doesn’t.

 

> To me, a numeric CASE without an ELSE is pointless.



Agreed. It was the absence of the ELSE clause and the fact

that the numeric case hadn’t been implemented in PO2013

for ~5 years now that caused me to believe that the

intended main use of the CASE statement is with records

and pointer types (i.e. to check extension levels),

where the ELSE clause is indeed not needed, since it

is implicit if the base type appears as the last case.



> My conclusion so far is: If the numeric CASE is not

> implemented but only specified, it should not be

> taken literally.



Extensions levels are (internally) also numbers of course ;-)

-- Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20180216/136dcae5/attachment.html>


More information about the Oberon mailing list