Squeak (ST80) syntax

Travis Griggs tgriggs at keyww.com
Wed Feb 16 18:47:26 UTC 2000


Stefan Elisa Kapusniak wrote:

> In edu.uiuc.cs.squeak, Dan Ingalls <Dan.Ingalls at disney.com> wrote:
>
> >Yes.  We refer to this as "implicit self".  Alan is the strongest
> >proponent of this appraoch in our group, actually, and SELF works
> >this way as well.  We seriously considered this also back in ST-74 (!).
> >The two things that have prevented enthusiastic adoption of this
> >approach are...
>
>    I have a nagging notion that part of the problem here
>    may be that "self" shouldn't have the name "self". I
>    think I'd feel better if it were "thisObject" or
>    something.  "self" really indicates me, myself, sitting
>    here at the keyboard typing this email.  I suspect
>    non-programmers find the overloading of the word a
>    bit confusing.
>
>    It's sort of like having to pretend you're the object
>    to work out what's going on or what to say.  I think
>    this might act as a hurdle -- tho' I don't have any
>    evidence of it.
>
>    Changing the name to something more like "thisObject",
>    would work better for 'typing in the air', and inspector
>    workspace type things, even if you didn't make any other
>    alterations.

I think the ever presence of self is a good idea; I note that in discussing
C++ and Java code samples with people, it often becomes obvious that it's
just scoped subroutines and structures as well. The fundamental basis of
message sending is often missed. I think the ever presence of 'self' drives
home the reciever <- message paradigm.

I do agree with Stefan on this name issue as well. My wife doesn't do
computer programming. Nor does my mother or brother or father or many other
people that one would find in other walks of life. Sometimes, the
discussions cross over to what I do. They recognize the "object oriented"
thing, because that's been made into a media buzz word. But they don't know
what it means. People ask "what IS an object?" And then I try to create a
map for them so that they can map terms that are familiar with them to the
OO way of thinking. I've always wondered why it is I have to do that. The OO
way of thinking is really a quite natural one, but it's masked in
computerese terms.

A while back, I did some experiments where I changed not the syntax of
Squeak, but the semantics of some of the core pieces of the language. It was
a real riot. What's an object? That's always the question I get asked first.
I always answered "It's a Thing." Why tell people that over and over again,
why not just make it so? So object got renamed to Thing (One can do this
without really screwing up the system by simply renaming Object, but giving
it two entry points in the Smalltalk dictionary, Thing and Object). Then
came nil. What's that? It's the single instance of UndefinedObject. But now
I guess it's an UndefinedThing, which is a long way of saying it's a
placeholder for Nothing. So UndefinedObject became Nothing, and an alternate
pseudovariable representation was added for nil: nothing (for grins a put a
"notta" in there too). It was amazing how simple this was to do in Squeak,
and yet maintain backwards compatibility. At this point I started noticing
that there was something cool about this "thing" stuff, it had a certain
metaness to it that was fun. I was able to have the "is Nothing someThing?"
discussion right there in Smalltalk. Of course it was, because Nothing
derived from Thing. At that point, it got really fun. The Smalltalk global
got renamed to Everything. Collection became Manything. I still haven't hit
on what Anything and Something should've been. Then it came to classes.
What's a class? A class is a kind of Thing. So, it got renamed. Kind. That
was easy to explain to my wife. When we got talking about Kinds of Things,
the whole notion of classification became much more tractible. Vehicle was a
Kind of Thing. Car was a Kind of Vehicle. And a particular instance of a Car
was a Kind of Car. The message kind was implemented in Thing to return
class. On the Kind (er Class) side of Thing, kind returned superclass. Since
I'd renamed everything else, it was time to rename the psuedo variables. To
make Things more anthropomorphic, "I", "me", "my", and "this" were added as
variations of "self". Since many people aren't boolean logic masters, "yes"
was added as an alternative for "true" and "no" for "false". Parallel
versions of ifTrue: and ifFalse: were added. I never did come up with a good
rename for super or thisContext. But the code started to look kind of cool,
and Squeak's very natural language appearance helped.

Set>>select: aBlock
    | result |
    result := self kind new.
    1 to: my size do: [:i | | something |
    something := I basicAt: i.
    something isNothing ifNo: [result add: something]].
    ^result

I would think this kind of semantic evolution would be more beneficial than
a syntactic one. Unfortunately, I never finished the above up and got it
out. I got hung up on trying to create a parallel namespace for this stuff
and then one tangent led to another... sigh.

--
Travis Griggs (a.k.a. Lord of the Fries)
Member, Fravenic Skreiggser Software Collective
Key Technology
P-P-P-Penguin  Power!






More information about the Squeak-dev mailing list