are RectangleMorph and Rectangle polymorphic

Dan Ingalls Dan at SqueakLand.org
Sun Nov 18 18:56:26 UTC 2001


ducasse <ducasse at iam.unibe.ch> wrote...

>I have the impression that  RectangleMorph and Rectangle are not
>polymorphic. Can somebody confirm this?

Yes, I can confirm this, as can anyone with Squeak.

>If this is true this is sad

Well, I agree, sort of.  It's a byproduct of how things have grown and how we use them.  We want what you want as well, so I certainly feel you deserve an answer.

The tension, and we haven't fully resolved it in the current Squeak, is one between primitive constructs and end-user access.

Morphic was introduced as, and is destined to continue as, a display architecture.  The morphs are shapes, but their primary responsibility in protocol has to do with morphic architecture -- bounds, borders, events, submorphs, canvases, etc.

Other things being equal, it might be nice if RectangleMorphs responded to Rectangle protocol, but other things are not equal.  A Squeak programmer (as opposed to an end-user!) almost never wants this.  One knows the thing is a morph and it would be considerably ambiguous to send it a rectangle message out of context:  Do you mean its bounds or its innerBounds, or its fullBounds?  In world coordinates or local coordinates?  Et cetera.

Now what about the poor end users?  Ask Alan;  he has been tearing his hair out over this while we have been working at the lower level.  If you explore the EToy framework, you will find that things are headed more in the direction you wish.  Here the scriptable entity is a Player, and there is intentional blurring of the morphic and model protocols.  In this context, the user just sees a Rectangle or a String, and expects it to respond as such, whether it has a concrete manifestation on the screen or not.  Scott's work on Vocabularies is aimed at exactly this kind of crossover between the basic protocols of Squeak and their concrete manifestations in morphic.

This should give you some hope, but it may not leave you completely satisfied.  It doesn't leave any of us completely satisfied either -- it's just the best way we see of how to approach the problem right now.

To me, as I said, the current state of affairs is a manifestation of the difference between system programming and end-user programming.  And the question is:  Should there be any difference?  Alan will say no.  I say I don't know.  But Alan has often turned out to be right ;-).

	- Dan




More information about the Squeak-dev mailing list