[Oberon] Serious type loophole in type case statements and a possible fix

Joerg joerg.straube at iaeth.ch
Fri Oct 30 17:58:52 CET 2020


>    1. Global case variables p in a case statement CASE p OF .. END

Module initializers can not have a CASE. But this seems acceptable.
>    2. Assignments *to* case variables p *within* the scope of a CASE statement  

If needed, declare a local variable and „mirror“ p. Seems an acceptable restriction. 
>    3. Passing a pointer case variable p as a VAR parameter to a procedure P(p)

I could imagine an example where you have a CASE in a loop and the procedure P returns an object with another type to be processed by the next iteration. Here the „trick“ with the local variable as mentioned above can help as well. Restriction for such rare cases seems acceptable.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20201030/23532dd5/attachment.html>

More information about the Oberon mailing list