[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible changes to abstract types proposal
- To: Mailinglist 'OOC' <ooc-list@informatik.uni-kl.de>
- Subject: Re: Possible changes to abstract types proposal
- From: Stewart Greenhill <greenhil@murdoch.edu.au>
- Date: Mon, 08 Feb 1999 10:28:45
- Delivered-To: jnzimmer@donau.informatik.uni-kl.de
- In-Reply-To: <16599697@oberon.noris.de>
- References: <3.0.1.32.19990202172216.0091aba0@central.murdoch.edu.au>
At 07:29 PM 6/2/99 +0100, hartmut Goebel wrote:
>Stewart Greenhill (greenhil@murdoch.edu.au) schrieb:
>
>
> >- Use of the NEW attribute to distinguish newly introduced methods from
> >re-defined methods. This makes it more difficult to accidentally introduce
> >a new method where you meant to override an existing one (eg. due to a typo
> >in a method name).
>
>unnecessary to introduce an new keyword for this: such errors are easily
>found in the very beginning of code writing.
True, but one might not actually find the error until run-time, when the
code does something unexpected. The advantage of the NEW tagging is that
most of these errors can be caught at compile time.
> >- Object finalisation. This helps to reduce the possibility of resource
> >leakage when garbage-collecting objects that encapsulate resources other
> >than memory (eg. OS handles).
>
>No Language extension is necessary for this! Simply use a baseclass e.g.
>"Finalized" and enter each object into a queue. See the Oberon System for
>implementation. Okay, not that nice, but can easily be hitten in a module.
Yes, that is another way of doing it. I'm not familiar with the Oberon
System. If the objects are in a queue, how does the system decide when to
call their finalisation procedures?
In BlackBox, ANYREC is an implicit base type for all record types. It has
built in declarations equivalent to:
ANYPTR = POINTER TO ANYREC;
PROCEDURE (a: ANYPTR) FINALIZE-, NEW, EMPTY;
This means that the default FINALIZE method does nothing, and that any type
can override it. However, it is exported as implement-only, so FINALIZE can
never be called by users' code, only by the system. The garbage collector
calls FINALIZE prior to deallocating an object.
- Stewart