Some Self ideas

Richard A. O'Keefe ok at
Fri Jan 19 03:15:22 UTC 2001

"Diego Gomez Deck" <DiegoGomezDeck at> wrote:
    I never suggested to remove the blocks!!! only make Object and Block
    polymorphic with respect to #value....
I can't speak for anyone else, but I understood that perfectly well the
first time.  It is precisely that blurring that I think would be a very
bad idea indeed.

For example, I just explained to someone here that in the Level 2 DOM
a TreeWalker is confined to its root Node (and the descendants thereof)
... except when it isn't.  In the same way, when you copy an EntityReference
from one document to another, it will be given a new expansion ... except
when it isn't.

This kind of mess is a *DISASTER* for anyone trying to understand a program.

The point of polymorphism is not to do drastically different things depending
on the receiver (how would it be if "animal quack" sometimes made a noise and
sometimes sent you a doctor?) but to do what is conceptually the *same* thing
in whatever the appropriate way is.

For example, suppose we had several different representations of code:
a labelled pointer to some C code, a wrapped chunk of 8080 instructions,
a pair containing an object identifier and a selector, ...
I wouldn't mind "thingy value" determining the value of the executable
thingy in a way that depends on what kind of executable thingy it is,
but I would mind very much if
	"(print 'hello)" value
sometimes returned the string itself (we already have #yourself for that)
and sometimes parsed and executed it as a Lisp expression.

An important design point in OO is

    Don't paint yourself in.

Suppose we had a rule that

    anObject value
	=> if anObject is a block, invokes it,
	   otherwise returns anObject itself.

That would prevent us ever making (aSymbol value) do something interesting
(which has been seriously proposed), or making some kind of Lisp interpreter
working on arrays, or any of a number of other things we might want to do
with #value, *without* changing its interpretation.

In short, this change
    - would get in the way of reasonable future extensions
    - is entirely unnecessary
    - would make the language harder to learn
    - (how many of these do you want?)

More information about the Squeak-dev mailing list