[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Abstract classes in Oberon / OOC



Michael van Acken <Michael.van.Acken@de.uu.net> writes:
> Stewart Greenhill <greenhil@murdoch.edu.au> writes:
> > Would it be possible to add something like this to OOC? Here are two
> > possibilities:
> > 
> > 1) Allow [ABSTRACT] tags to be used on RECORD and PROCEDURE declarations.
> > For ABSTRACT procedures the body is ignored if specified.
> > -- OR --
> > 2) Interpret a procedure with a single HALT(abstractMethod) statement as an
> > abstract method.
> 
> Version 2 has little appeal.  I would only support version 1 if any
> system flags "[...]" are _only_ permitted if this is explicitly
> requested in the module header.  Previously oo2c disallowed system
> flags altogether in standard modules (i.e., modules that are neiter
> INTERFACE nor FOREIGN), currently oo2c permits them anywhere so we can
> evaluate the necessary extensions for the Win32 API.

I'd prefer version 1 too.  Would a compilation error occur when a
RECORD is declared as non-abstract, but has a type-bound procedure
that is declared as abstract?  

> > Comments? Language purists: please don't flame me too hard :-)

In Josef Templ's dissertation "Metaprogramming in Oberon", he points
out the need for abstract methods.  He makes two suggestions for
notations, and I liked the second one: This solution "would be to
employ Oberon's forward-declaration mechanism and to regard
unresolved forward methods as being abstract."  In our case, a class
that has any abstract methods would be an abstract class.  I'm not
saying this is preferable to version 1 above, but I thought I would
share a possible alternative.


Eric