The Science of Programming/SwayPresentations/Objects/ReificationInheritance

 Reification Inheritance 

Reification inheritance: whereby the subclass completes (or partially completes) an incomplete superclass.

function super {       function a(x) { b(x * x); } this; }

function sub {       function b(y) { y + 1 * (y - 1); } extends(super); }

Now we make a sub object:

var s = sub; inspect(s . a(3));

The output is:

s. a(3) is 80

Sway allows you to look at the concatenated environment:

ppObject(s);

yields:

: context:  dynamicContext:  callDepth: 1 constructor:  this:  b:  a: 

Next Previous Top