[Oberon] Oberon for a C++ user.

Serge Durmanov serge.durmanov at yandex.ru
Wed Nov 2 08:41:04 CET 2016


Hi Felix.

Cool! But there are several remarks and questions.
1) Initialisers/finalizers, like Objects aren't realized.
2) Doesn't work the operator NEW in the form of "v : = NEW T (); T = POINTER TO R; R = RECORD.;"
3) Syntax the Oberon-2 looks alienly in Active Oberon, it is necessary to switch from syntax the O2 to syntax AO and vice versa. If it is planned the type-bounded procedures for records only, then as it seems to me, it is better to use the unified syntax of Objects.
TYPE
 R = RECORD
  value: INTEGER;

  PROCEDURE & Init( );
  BEGIN
   SELF.value := 100;
  END Init;

  PROCEDURE P*( );
  END P;
 END;

And in addition realize a front-end the Oberon-2;

4) If nevertheless Oberon-2 style is more preferable, then the receiver form without identifier, with use of the predefined designator SELF is more preferable:

 R = RECORD
  value: INTEGER;
 END;

 PROCEDURE ( VAR T ) & Init( );
 BEGIN
  SELF.value: = 100;
 END Init;

 PROCEDURE ( T ) P*( );
 END P;

As, additional any identifier in the form of PROCEDURE ( r: T ) P*( ); complicates perception of the stranger / inaccurately written code, brings excess entities, besides it is necessary to remember a receiver name.

5) If the field in record has an initialiser, that field isn't initialized if record is imported:
MODULE M1;
  R = RECORD
    i := 100: INTEGER;
  END;
 
 MODULE M2;
 IMPORT M1;
  O = OBJECT
    VAR r: M1.R; (*!*)
  END O;

6) Everything works at simple artificial tests, but more real tests are required. Therefore I will continue work on AGG library (High Fidelity 2D Graphics), using the improved records. I think, it will be the good test.

7) What happens to the cooperative A2? It isn't compiled or doesn't work( if compiled).

Serge


> 02.11.2016, 03:56, "Felix Friedrich" <felix.friedrich at inf.ethz.ch>:
> Hi Serge


More information about the Oberon mailing list