[Oberon] ABSTRACT to EMPTY redefinition in Component Pascal

Diego Sardina dsar at eml.cc
Sun Apr 15 19:09:23 CEST 2018


On Wed, Apr 11, 2018, at 4:36 PM, Josef Templ wrote:
> In practice, I think, there are not too many use cases for overriding an ABSTRACT method by
> an EMPTY method but it is possible to think of the following situation:
> 
> An ABSTRACT base type *Object *provides ABSTRACT methods *Store* and *Load*
> for persisting the contents of an object.
> A concrete sub-type must implement all methods but if there is nothing to store resp. load, the implementation of *Store *and *Load *could be simply marked EMPTY.
> 

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


More information about the Oberon mailing list