[Modules] Upper case message names for accessing modules

Chris Becker chb99 at msn.com
Fri Feb 22 16:08:10 UTC 2002


On Thu 2/21/02 8:36 PM, Norton, Chris wrote:

>[ I hope I'm not showing too much ignorance here; I admit that I haven't
really been following the modules >discussion very carefully... I've been
awfully busy with work ]
>
>It seems to me that:
>
>ellipse := Squeak Morphic Core Basic EllipseMorph new.
>
>Or the other variants of that statement are unduly clunky.  There is a rule
of thumb that I recall, the "Law of >Demeter" that basically suggests: if
you want to change the channel on your TV, use the knobs, don't open it up
>and mess around with the wiring.

Great analogy. So Squeak is like a TV ... does that make Demeter a TV
repairman?

>I interpret this to mean that we should avoid multiple message sends in a
>single statement (of course cascading is a useful exception).  I truly
think
>that Smalltalk's power is in its simplicity
>
>aReceiver aMessage
>
>To make a longwinded story short, might I suggest that we strive to keep
Squeak's syntax as simple as possible.  >Perhaps something like this would
work:
>
>SqueakMCB := ModuleReference new: #(Squeak Morphic Core Basic).
>ellipse := SqueakMCB.EllipseMorph new.

Hmm ... looks to me like you've opened the TV and rewired it yourself! Since
when can Smalltalk's end-of-statement character (.) be used in this way?
Methinks you've been doing too much Java lately.

(Aha! *Java* is the language that's like a TV ... one that *can't* be
opened!! No matter how much you pay for this TV, it still belongs to a
company named Sun. But I digress ...)

>Heck, I'm shootin' from the hip here, but to continue this idea, perhaps we
could have a (gasp) global pool >dictionary that associates module shortcuts
(keys) with explicit module references (values).  Then any old chunk of
>code could look like this:

(You mean any old chunk of part-Java part-Smalltalk code)

>ellipse1 := MorphicCore.EllipseMorph new.
>ellipse2 := MyMorphicModule.EllipseMorph new.
>ellipse1 = ellipse2 ---===> false

Sorry, but your use of the (.) kinda stops the show. Literally.

>Then later, if/when a file-out is desired, module references get their own
section in the file-out that describes them >completely for that file-out.
>
>Cheers,

Prost!

>
>---==> Chris

Chris




More information about the Squeak-dev mailing list