[Oberon] objects and jewels:WITH and Messages
Frans-Pieter Vonck
fp at vonck.nl
Wed Feb 20 17:49:41 CET 2013
Hi Chris,
thank you for the article. It is good to re-read it once a while.
I understand that procedure types are a necessary feature - and a safe
alternative for Function overloading.
Still, the WITH statement is abandoned in Oberon07. Now what does that
mean for object orientation.
And is it still possible to port the Oberon System to the ARM using
Oberon07. Or, a little more humble, can I send messages to my Led?
If found this text
"MESSAGE RECORDS
Type-bound procedures are one way to implement messages. Another way is to
take the phrase "sending a message" literally and to view a message as a
packet of data that is sent to an object. This requires message records of
various kinds and lengths and a handler per object that accepts all these
message records. Type-extension provides these two mechanisms. Messages
are extensible records and the handler is a procedure which takes a
message as a parameter and interprets it according to the dynamic type of
the message.
[..]
( a "BlinkaLed" message Handler)
PROCEDURE HandleLed (f: led; VAR m: Message);
BEGIN
WITH
m(OffMsg) DO ...switch led of ...
| m(OnMsg) DO ... switch led on ...
| m(BlinkMsg) DO ... blink led with x miliSeconds ...
ELSE (* ignore the message *)
END
END HandleRect;
source:
http://www.statlab.uni-heidelberg.de/projects/oberon/kurs/www/Oberon2.OOP.html
>> -----Original Message-----
>> From: Frans-Pieter Vonck [mailto:fp at vonck.nl]
>> Sent: Wednesday, 20 February 2013 3:47 AM
>> To: oberon at lists.inf.ethz.ch
>> Subject: Re: [Oberon] objects and jewels
>>
>> this was the interview I remembered. However the interview mentions
extention of record types, but not the introduction of procedure types.
>>
>
> That was most likely because procedure types had been around for many years
> when that article was written. They were introduced in Modula-2 at the
beginning of the 1980's:
>
> "An uncontroversial, fairly straight-forward, and most essential innovation
> was the procedure type, also adopted from Mesa. In a restricted form it had
> been present also in Pascal, even ALGOL, namely in the form of
parametric procedures. Hence, the concept needed only to be generalized,
i.e. made applicable to parameters and variables. In respect to Pascal
(and ALGOL), the mistake of incomplete parameter specification was
amended, making the use of procedure types type-safe. This is an
apparently minor, but in reality most essential point, because a
type-consistency checking system is
> worthless if it contains loopholes."
>
> Ref: "Modula-2 and Oberon" Niklaus Wirth. Paper submitted to HOPL-3,
June 2005:
>
> http://www.inf.ethz.ch/personal/wirth/Articles/Modula-Oberon-June.pdf
>
> Regards,
>
> Chris Burrows
> CFB Software
> http://www.cfbsoftware.com
>
>
>
>
>
>
>
>
More information about the Oberon
mailing list