Re: Persistence and supercalls under BlackBox

From: [at]} <Hans>
Date: Mon, 15 Feb 1999 04:40:18 +0100

Wojtek Skulski wrote:
> I am a bit confused with persistence and supercalls under BlackBox.
>According to my Oberon System experience, I need to supercall
>an inherited Store/Load method to store/load inherited data
>fields. Therefore, I have written my own Externalize procedure like
>the following. Note the supercall.
>
> PROCEDURE (h: Histogram) Externalize- (VAR wr: Stores.Writer);
> BEGIN
> wr.WriteVersion(0);
> h.Externalize^(wr); (* parent class method supercall *)
> XiaArrays.StoreIntArray (wr, h.bin);
> XiaArrays.StoreRealArray (wr, h.xval);
> wr.WriteBool (h.calibrated)
> END Externalize;
>
>However, when looking at Wolfgang Weck Graph sources,
>his Externalize looks different, and it works without the supercall:
>
> String = ARRAY 256 OF CHAR;
> Figure = POINTER TO RECORD(GraphModels.Figure)
> s: String
> END;
>
> PROCEDURE (fig: Figure) Externalize (VAR wr: Stores.Writer);
> BEGIN
> wr.WriteVersion(0);
> wr.WriteString(fig.s)
> END Externalize;
>
>
>I am wondering what is going on. Is the parent class' GraphModels.Figure
>
>Externalize method called "automagically" ?
>
>I looked at the Stores docu, and it does not say a word on the need
>to make a supercall. However, my previous Oberon understanding
>of the meaning of inheritance tells me that supercall has to be made.
>(Just read the Mossenbock book, for example.)
>

This issue puzzled me too for a while. But gradually I'm starting to
understand it (I hope).

Since the transition of Oberon/F to BlackBox/Component Pascal the use of
super calls is strongly discouraged (and may no longer be supported in
future versions ). The reason being that it has become clear that their use

might lead to the so called semantic fragile base class problem (a subclass
might become invalid if using implementation inheritance (super calls) and
the implementation of the superclass is changed).

This is why the procedures Externalize and Internalize in module Stores
should be regarded as EMPTY (actually they are EXTENSIBLE for compatibility
reasons) They should not be called but only extended (implemented) by
inheriting object types (which only inherit their interface).

Some information on this is in the following BlackBox documents (see the

Help index):
  Differences to release 1.2
  Component Pascal Language Report
  What's new?
  Programming conventions
  DevCPConv-docu

More extensive information on the rationale for this change is in the book
by Clemens Szyperski (1998): Component Software - Beyond OOP.


Hans Klaver


P.S.:
One of the difficulties I had at first was in understanding the difference
between super call and up-calls. A super call is a call to a super class
(base class, lower down in the module hierarchy), an up-call is a call to a
sub class (higher up in the module hierarchy). So: up-call = "sub call" (#
super call).
A framework like BlackBox heavily relies upon up-calls but tries to avoid
super calls!
Received on Mon Feb 15 1999 - 04:40:57 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:42 UTC