Need feedback on simple idea

Adam Spitz aspitz at student.math.uwaterloo.ca
Fri Apr 11 16:03:16 UTC 2003


Randal L. Schwartz wrote:

> In fact, I'll be so bold as to say that anyone who automatically
> creates setters and getters for *every* instance variable is not
> thinking in OO yet.

<shrug>  That's not really what we're going for here. All of the old
advice about not using accessors all willy-nilly still applies. It's
just not enforced by the language anymore. I can see how that could be
scary, but, as Nathanael said, we don't really have much privacy now
anyway.

Self manages to do some really cool things as a result of turning
everything into a message send. The important one is that it gets rid of
the need to write "self" explicitly as the receiver. This sounds like
just a minor bit of syntactic sugar, but it's got a really nice
consequence: suddenly the most flexible operation (sending a message) is
also the operation with the nicest syntax.

That's how Self does namespace-like things, for example. To access a
"global" in Self, you just send a message to yourself. The syntax is
just as convenient as Smalltalk's syntax for globals, and much more
flexible; it's just an ordinary message send. You can have a whole
hierarchy of nested namespaces - and it's all still just made up of
objects sending messages to each other.

Of course, maybe all this flexibility isn't such a good thing. I kinda
like it, but it's certainly not clear-cut. But this isn't just a case of
the silly Self people throwing out good OO principles; in a lot of ways,
Self's system is *better* at supporting good OO principles.


Adam Spitz



More information about the Squeak-dev mailing list