[Oberon] Oberon for a C++ user.

Felix Friedrich felix.friedrich at inf.ethz.ch
Tue Nov 1 22:29:40 CET 2016


Hi Serge

Inspired by your email and driven by my interest in value semantics in 
Active Oberon, I have now experimentally added type-bound procedures on 
records in Active Oberon supporting polymorphism etc, i.e. Oberon-2 
within Active Oberon.

We have to experiment and identify how this works together with Active 
Objects. Feedback welcome.

Best regards
Felix

The following works, for example

MODULE Test;

TYPE
     R* = RECORD Y,X*: LONGINT; END;
     S* = RECORD(R) Z: LONGINT; END;

PROCEDURE (VAR r: R) Test* (x: LONGINT): LONGINT;
BEGIN
     TRACE(r.X,.r.Y);
     RETURN r.X + x + r.Y;
END Test;

PROCEDURE (VAR s: S) Test (x: LONGINT): LONGINT;
BEGIN
     TRACE(s.X. s.Y, s.Z);
     RETURN s.X + 2*x;
END Test;

PROCEDURE TestDyn*(VAR r: R);
BEGIN
     TRACE(r.Test(10));
END TestDyn;

PROCEDURE Test*;
VAR r: R; s: S;  z, zz: LONGINT;
BEGIN
     r.X := 123;
     TestDyn(r);
     TestDyn(s);
END Test;

END Test.




On 26.10.2016 14:10, Serge Durmanov wrote:
> 27.09.2016, 23:11, "Felix Friedrich" <felix.friedrich at inf.ethz.ch>:
> ...
> > Let me first of all confess that I like Oberon-2 a lot. I always thought
> > it would be a good idea to reintroduce the type bound procedures on
> > value types in Active Oberon. [Most important difference to Active
> > Oberon in this context: methods can be defined outside the scope of an
> > object, methods can be defined on records, not only pointer to records.]
> >...
> Hi, Felix.
> Hi, Felix.
> Are there any changes to the language in this plan?
> We need not reference types that have the methods that adds to the 
> convenience in the design and simplifies the code. I did the porting 
> on the Active Oberon AGG lib, and lacked methods on the records, and I 
> make a separate module (one record type - one module), but it is not 
> convenient and not possible to do polymorphism. I go back to classic 
> Oberon and use procedural variables in records. But ...it is the 
> sundown manually
> Serge
>
>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20161101/550e454e/attachment.html>


More information about the Oberon mailing list