[Oberon] Oberon and closures
J ö rg Straube
joerg.straube at iaeth.ch
Thu Oct 30 09:11:57 MET 2008
What about this?
MODULE Example;
(* my oberon is also a little rusty *)
TYPE
Printer = POINTER TO Closure;
Closure = RECORD
n-: INTEGER;
Print: PROCEDURE();
END;
PROCEDURE CreatePrinter*(i: INTEGER): Printer;
VAR s: Printer;
BEGIN
NEW(s); s.n :=i; RETURN Printer
END
VAR p, q: Printer;
BEGIN
p:=CreatePrinter(2);
q:=CreatePrinter(3);
p.Print
q.Print
END Example.
Joerg
More information about the Oberon
mailing list