[Oberon] ABSTRACT to EMPTY redefinition in Component Pascal

Josef Templ josef.templ at gmail.com
Mon Apr 16 17:35:02 CEST 2018


>
> I thought that It could be used to have (a sort of) multiple interfaces,
> grouping all the methods as abstract in the the base record and selecting
> only those that are needed in later extensions.
>
> For example a Stream class may have all the (stream related) methods as
> abstract, while non-buffered extensions redefine flush() as EMPTY.
> However not all streams have positioning, but I can't redefine tell() as
> EMPTY since it returns something.
>
> So it looked like rather limiting.
>
> --
> Diego Sardina
>
>

I think of EMPTY as a short-hand notation for BEGIN END ProcName;
In principle, it would allow the compiler to save a few bytes and use a
generic stub for the return code,
but only if such a generic stub is possible on a particular target platform.
This depends on the details of managing the run-time stack.
The i386 code generator is not using a generic sub.

In addition, the compiler puts a flag into the symbol file that marks an
exported EMPTY procedure.
This is used for checking if a super call to an EMPTY procedure is made.
Super calls are not
allowed for EMPTY procedures. I am not sure why. It may be because it does
not give sense to
call something that does nothing by definition. But this is disputable, I
think. It breaks the abstraction
in the sense that it tells you something about the (missing) implementation
of a procedure.

In general, I am not aware of any other major OOP language that has a
similar concept.
It does not seem to be very important, and, yes, it is rather limited.

- Josef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20180416/9ab26707/attachment.html>


More information about the Oberon mailing list