inheritance models (was: Lessons learnt from the Self archive)

Jecel Assumpcao Jr. jecel at
Thu Jun 16 19:13:13 UTC 2016

> > One result was that the papers gave people ideas for their own
> > languages, of which I think only Io (via NewtonScript) and Javascript
> > had any impact.
> Lua is also a bit Self-ish but I don't know if there is a direct influence?

Lua is the only language I know of besides Self that ever got simpler
from one version to the next. While Lua doesn't have a native object
system, it is trivial to roll your own. Since Lua does everything with
hash tables and these are similar to Self's slots, I would be very
shocked if Lua's creators were not aware of Self when they added the
meta table stuff that made objects possible. The main influence on Lua
was Tcl, however.

> I find it interesting that neither of those languages adopted Self's
> inheritance model which I personally think is an improvement on its
> successors, so to speak. I've never been sure if that was because
> the language designers misunderstood how Self worked (easy to
> do when working from papers only) or rejected it in favour of the
> other model.

If you read the original Self paper and then went on to read Herny
Lieberman's "Prototypical Objects to Implement Shared Behavior in Object
Oriented Systems" it was easy to think that both implemented the same
inheritance model. I certainly did for a year or two.


I will call Liberman's model "differential prototypes" and Self's model
"full prototypes". Liberman calls his inheritance model "delegation" but
I don't see the need to make this distinction if you allow one object to
"inherit" from another (Beta is one language in which there is a

With differential prototypes you create a new prototype as an empty
object which inherits from the old prototype. You then start adding
stuff to the new object, including using copy on write slots to allow
changes to be independent from the old prototype.

With full prototypes you create a new prototype by cloning the old
prototype. You then start adding and changing things in the new object
while the old one is unaffected. Anything that you want to be shared
between the old prototype and the new one should be in a parent (traits)
object that both inherit from.

The differential model is more dynamic and leads to messier systems.
This is what NewtonScript adopted and what was copied into Io. For many
years Steve Dekorte (who created Io) thought that Self also used this
model and it took us quite a while to convince him that this wasn't the

The full model makes Self way more Smalltalk-80-like than it would
otherwise be. It makes inheriting "shape" harder than the differential
model, however. For example: if you have a 2D point object with "x" and
"y" data slots and now want to make a 3D point with the same slots plus
a "z" data slot it seems simple enough - just clonethe point prototype
(0 at 0, for example) and add the "z" slot. The problem is that you might
later want to make a change to the "x" slot in the 2D point and have
that change be reflected in the 3D point (as it would be in Smalltalk).
Rather than solve this at the programming language level, the
programming environment got a feature called "copy-down slots" to
automate this process.

Self has the resources needed to add copy-on-write slots which would
then allow the differential model to be used.  And NewtonScript/Io/etc
can certainly be used with full prototypes without any changes to these

-- Jecel

More information about the Self-interest mailing list