[Oberon] Case statements containing base type labels

Diego Sardina dsar at eml.cc
Mon Aug 28 13:21:52 CEST 2023


On Mon, Aug 28, 2023, at 13:15, 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/000f9dc5/attachment.html>


More information about the Oberon mailing list