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

Diego Sardina dsar at eml.cc
Fri Oct 30 20:33:47 CET 2020

On Fri, Oct 30, 2020, at 3:25 PM, Luca Boasso wrote:
> I remember reading about a similar issue related to the WITH statement of Oberon-90, so the way I solved this problem in oberonc is to add an additional type test each time the case variable is referred in the statements of a particular case label.

This is the way to go.

The WITH's loophole was fixed in Oberon-2/CP (at least in report) by specifying explicity:

"[...] and apply a typeguard to every occurrence of the tested variable within this statement sequence."

Oberon-90 says something similar with different words and it's not clear what is the meaning of "extending the guard over an entire statement sequence".

In my opinion, these two statements have the same meaning. In Oberon-2 they made it straightforward.

So the WITH statement is just a syntactic sugar to avoid the type guard syntax and the loophole is just an optimisation issue.

  Diego Sardina

More information about the Oberon mailing list