[Oberon] Oberon Wiki ; what happend with WITH

Christian Demmer chris at gcjd.de-web.ws
Sun Jan 9 23:44:40 CET 2011


Frans-Pieter Vonck wrote:
>I also found that in the Oberon07 reports that the WITH statement is
>omitted, however there is no explanation why this was done. From the
>examples of the Wiki pages I could not conclude myself why leaving WITH
>out of the language was a good thing.

I think there are several reasons.

1) It's syntactic sugar somewhat and not often needed from my
experience.

2) It has non local effect changing a variable's type in a
subscope, which is not a good idea. This is a concept
that is otherwise absent in Oberon. It also makes reading source harder
if variables may not have their declared type sometimes. 

3) There is a problem in the ETH compilers described here:
<http://ooc.sourceforge.net/OOCref/OOCref_14.html#SEC110>

>Wikipedia does not show an example of the use of IS in comparison to the
>WITH method.

If T1 is an extensions of T0 I would say:

VAR
  v : T0;
BEGIN
  WITH v : T1 DO  "use v"  END;
  IF v IS T1 THEN  "use v(T1)"  END;


Greetings, chris



More information about the Oberon mailing list