[Newbie] Dolphin Smalltalk Tutorial

Richard A. O'Keefe ok at atlas.otago.ac.nz
Tue Apr 18 02:46:03 UTC 2000


    "Richard A. O'Keefe" <ok at atlas.otago.ac.nz> responded:
    >I've just thrown together a simple change which appears to do
     the right thing.
    >I would greatly value comments on the style of this change.
	    <followed by some code>

	One of the first tools any newbie should learn is the
	methodFinder and/or its cmd-key abbreviation cmd-shift-w.

One of the first things any newbie who _tries_ Cmd-Shift-W leans
is that it's awfully easy for your finger to slip off the Shift
key, in which case you've deleted what you're looking for.
The second thing a newbie learns is that it can take an extremely long time.

	If you had typed 'reverse' into the methodFinder or selected
	that word and used the cmd-key abbreviation, you would have
	discovered that Squeak already includes this functionality with
	the selector named 'reversed', as well as a few useful variants
	such as reverseDo:.

It's not clear whether "you" here refers to the original poster, or to me.
Perhaps the original poster _did_ try "reverse<Cmd-Shift-W>" and was
confused by the fact that "FlippyArray2" does contain a 'reverse' method,
as do quite a number of classes, sometimes meaning "reverse order" and
sometimes meaning "opposite colour".

If it was a reference to me, I knew about 'reversed'.  Point is, if you
want to follow through examples in a tutorial, to be continually changing
those names for these names is really confusing.  It's one of the features
of Smalltalk that you *can* add a new method to a class like
SequenceableCollection (you *can't* do that to STL classes in C++ or built
in classes in Java).

The code I posted didn't just define #reverse.  It defined #reverse
in terms of #reverseFromTo:, a method which does *not* currently have
an analogue in String or SequenceableCollection or anywhere like that.
Indeed, it is Cmd-Shift-W that reassured me that #reverseFromTo is not
currently provided.

	These tools can save people from ... writing code that
	has been written before (though it is always fun to write new code).

Oh?  Where _is_ #reverseFrom:To: defined in Squeak 2.7?
I'm perfectly well aware of #reverseDo:, and there isn't any sliced
version of that either.

The naming confusion of #reversed in some cases, #reverse in others, and
"reverse" sometimes meaning reverse sequence and sometimes meaning opposite
colour seems to go back a long way in Smalltalk history, and it's not clear
that much can be done about it without breaking the backwards compatibility
that I value Squeak for.





More information about the Squeak-dev mailing list