[self-interest] Changing prototype chain as state machine

Jecel Assumpcao Jr. jecel at merlintec.com
Fri Sep 30 17:50:07 UTC 2011

David Ungar wrote:

> Thanks, guys. I'll read the Ego paper.

I only skimmed through it, but it seems to be another case of "Self as I
imagine it from reading the papers" instead of "Self as it really is
from using it". The idea of dynamic inheritance using data parent slots
is not mentioned at all, but the focus is on using _AddSlots: and
friends to change objects during an application's execution. It
certainly would work, but it would also defeat all the optimizations
built into the VM.

This style of programming is used a bit in Javascript and the people,
like Lars, who have recently done high performance implementations of
that language have had to deal with this problem. So there is not reason
why a new implementation of Self couldn't handle lots of _AddSlots:, but
it hasn't been the focus so far.

In fact, that is also true for dynamic inheritance. If you use
assignable parent slots then you will take a huge hit in terms of
performance. When Urs Hölzle was asking for application in Self to test
the compilers he had created for 3.0 (and which we still use today) I
sent him my CMOS simulator but it was useless for him exactly because I
had used dynamic inheritance. In my case it was just a nasty hack to
make the Self REPL work as a nice command line for my simulator. The one
example I know of that does use assignable parents as intended is the
tree objects in collections.

Given how dynamic inheritance is actually used (to switch among a small
number of constant objects rather than point to arbitrary ones) I came
up with an implementation were an object with a dynamic parent would
have several maps, one for each parent (up to five, for example). When
you assign to the parent slot, you switch maps as a side effect.

> A while back I gave a keynote at OOPSLA on the role of paradox in language
> design.In general, I believe that better type systems are worse--depending
> on the context. One loses the power of ambiguity. However, if you are
> sending code to Mars, it's a good tradeoff. Anyway, I'll have to read the paper.

I watched that talk - you had some static typing people grinding their
teeth :-) Back in 2003 Java was at its zenith and stuff like Ruby and
Javascript were still being ignored. By a coincidence, I had started
using "sending code to Mars" in the mid 1990s as an example were
traditional software engineering practices would be a good idea in
contrast to other applications with GUIs where you might get better
results through exploratory programming (we didn't have the term "agile
programming" yet, though we already had some of the methods like Scrum).

-- Jecel

More information about the Self-interest mailing list