[Oberon] Block objects for Oberon

Joerg joerg.straube at iaeth.ch
Tue Apr 7 23:07:29 CEST 2020


Richard

This is the proposed new syntax
PROCEDURE Client;
  VAR
    sum: INTEGER;
    collection: Collection;
    obj: Object;
  BEGIN
     sum := 0;
     collection.ForEach(obj, DO
        sum := sum + obJ.value
     END)
END Client;

Why not turn the logic around and use standard Oberon like this?

PROCEDURE Client;
  VAR
    sum: INTEGER;
    collection: Collection;
    obj: Object;
  BEGIN
     sum := 0;
     collection.first(obj);
     WHILE collection.forEach(obj) DO
        sum := sum + obj.value
     END
END Client; 

br
Jörg

> Am 07.04.2020 um 22:22 schrieb Richard Hable <informujo at aon.at>:
> 
> Hello all
> 
> Due to current events, the ACM Digital Library is now accessible for
> free. This also includes many articles related to the Oberon programming
> language!
> 
> My favorite one is “Treating Statement Sequences as Block Objects” by
> Hanspeter Mössenböck, in which he describes a simple extension to
> Oberon-2 which allows implementing iterators (and more!) in an amazingly
> efficient and elegant way:
> 
> https://dl.acm.org/doi/abs/10.1145/142137.142157
> 
> Block objects (statement parameters) also appear in Wirth and Hoare’s “A
> Contribution to the Development of ALGOL”:
> 
> https://dl.acm.org/doi/abs/10.1145/365696.365702
> 
> Richard
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list