Fwd: BankAccount Tutorial

Dan Ingalls Dan at SqueakLand.org
Fri Jun 29 12:52:58 UTC 2001


Hello Michael -

This is the result of the Alignment rewrite last fall.  A bunch of protocol has changed, and we don't even use alignment morphs any more, although they *should* still work.

>>I have been working through the tutorial but when I try to "accept" the
>>following code,
>>
>>historyMorph
>>    |bars m|
>>    bars_history collect: [:v| Morph new extent: 5 at v].
>>    m_AlignmentMorph newRow centering: #bottomRight.
>>    m addAllMorphs: bars.
>>    ^m
>>
>>Squeak tells me that "centering:" is an unknown selector.  Of course, when I
>>told it to confirm and then tried to do a "printIt" in the workspace of the
>>following, I get an error.  I believe I know enough about Squeak that I
>>shouldn't have had to ask it to confirm "centering:"

Well, I disagree that you "shouldn't" have been asked to confirm.  What it is saying is "You will get an error if you try to execute this (so you might want to stop now and fix it), but if you intend later to define #centering:, then you may want to proceed as is.

>>, and just because I did
>>confirm it, doesn't mean that their is an object to communicate with, am I
>>right?

There is an object, but it does not understand #centering:.  Note that, if you really knew what you were doing, you could have confirmed and then, when you got the error, you could have defined #centering:, and then proceeded, and all would have worked.  This is why you are allowed the option of proceeding.

>>Is the tutorial wrong, or is my version of Squeak (3.0) inappropriate, or
>have I made some error in copying it?

The tutorial is out of date because the alignment rewrite did not preserve the existing protocols.

Here is how I figured out the problem to answer your dilemma:

1.  I confirmed your experience.

2.  I knew there must be some new protocol similar to #centering:, so I selected
bbottomRight, and used cmd-N for find all references to it (all seNders for that message.

3.  This did not find anything I hoped for (users of a new centering message), except that it located the wonderfully revealing method,
	convertOldAlignmentsNov2000: varDict using: smartRefStrm
which makes it quite clear that the old #centering: message has been replaced by a new #wrapCentering: message.

4.  When I made that change to the above code from the tutorial, it did something reasonable (I haven't tested the rest of the tutorial).

If you wish to know more about the new alignment protocol, you might look through the TableLayouts project on Bob's Superswiki, which documents a lot of the changes that were made.

Hope this helps.

	- Dan

-- 





More information about the Squeak-dev mailing list