[Oberon] Oberon for a C++ user.

Douglas G Danforth danforth at greenwoodfarm.com
Mon Nov 14 00:53:05 CET 2016


 From the Component Pascal documentation
"10.4 Finalization

A predeclared method named FINALIZE is associated with each record type 
as if it were declared to be bound to the type ANYREC:

     PROCEDURE (a: ANYPTR) FINALIZE-, NEW, EMPTY;

The FINALIZE procedure can be implemented for any pointer type. The 
method is called at some unspecified time after an object of that type 
(or a base type of it) has become unreachable via other pointers (not 
globally anchored anymore) and before the object is deallocated.
It is not recommended to re-anchor an object in its finalizer and the 
finalizer is not called again when the object repeatedly becomes 
unreachable. Multiple unreachable objects are finalized in an 
unspecified order.
"

On 11/13/2016 11:41 AM, Diego Sardina wrote:
>> I am of the opinion that Component Pacal *should*
>> just become the official Oberon of the future.
>>
>> Wojtek
>
> Oberon is just Oberon and Component Pascal is just
> Component Pascal :-)
>
> I don't like all those extravagant keywords and it's
> not true that *a pure client programmer never needs
> to write any of above attributes* as the What's New
> document states.
>
> For example: I just want a final record, that extends
> no record, with some type-bound procedures, for a
> very simple use-case.
>
> TYPE
>   MyFinalRec = RECORD
>     [...]
>   END;
>
> PROCEDURE (VAR m : MyFinalRec) Method(), NEW;
> BEGIN
>   [...]
> END Method;
>
> I'm forced to use the NEW keyword, due to the fact
> that Method() is newly introduced.
> But it is meaningless for a final record that does
> not extend a record.
>
> To make it disappear, I have to make an interface
> for that record like this:
>
> TYPE
>   IMyFinalRec = ABSTRACT RECORD END;
>
> PROCEDURE (VAR m : IMyFinalRec) Method(), NEW, ABSTRACT;
>
>
> Extending this record (or in an alternative form:
> implementing this interface) the NEW keyword will
> disappear (of course).
>
> Now I'm a pure client programmer, but before I had
> to be a software designer :-)
>
> Except for some minor points like the above one, I
> have to say that I like Component Pascal and it's
> a pity that they did not include Szyperski's work
> on (a lightweight) Parametric Polymorphism.
>
> Anyway I tend to like more Oberon/Oberon-2 than CP,
> software design is a very important discipline but
> it is not everything.
>
>
> -- 
> Diego Sardina
>
> -- 
> 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/20161113/a3f2f80a/attachment.html>


More information about the Oberon mailing list