[Oberon] Case statements containing base type labels

joerg.straube at iaeth.ch joerg.straube at iaeth.ch
Mon Aug 28 14:05:26 CEST 2023


Diego
Okay. Then it can be seen as ELSE of the CASE 😊
Jörg

Von: Oberon <oberon-bounces at lists.inf.ethz.ch> im Auftrag von Diego Sardina <dsar at eml.cc>
Datum: Montag, 28. August 2023 um 13:40
An: oberon at lists.inf.ethz.ch <oberon at lists.inf.ethz.ch>
Betreff: Re: [Oberon] Case statements containing base type labels
On Mon, Aug 28, 2023, at 13:15, joerg.straube at iaeth.ch<mailto:joerg.straube at iaeth.ch> wrote:

August



In Oberon-07 it is defined as follows:

The type T of the case expression (case variable) may also be a record or pointer type. Then the

case labels must be extensions of T, and in the statements Si labelled by Ti, the case variable is

considered as of type Ti.



PROCEDURE Draw (s: Shape)

BEGIN

  CASE s OF
       Rectangle: ... |
       Circle: ... |
       Shape: ... • this is not allowed as “Shape” is not an extension of “Shape”
   END
END Draw;



Jörg



A record type is also an extension of itself. So that is valid.

--
Diego Sardina

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20230828/68caccef/attachment.html>


More information about the Oberon mailing list