[Modules] Upper case message names for accessing modules

Chris Becker chb99 at msn.com
Sat Feb 23 17:28:21 UTC 2002


In your example, how would you find MorphicEllipse in the system browser?
Would MorphicEllipse actually become the name of the class when you
loaded/installed the module? If not, this would still be confusing because
you can't look at the code and tell what is a class with a module prefix,
and what is a simple class name.

Actually, I proposed the "Squeak modMophic ..." variation thinking that
Squeak was going to become a class that you could send uppercase module
names to. I came to conclusion based on the examples in this discussion
thread, but after examining the Squeak3.3a-4744 image I now realize that
Squeak is just a module name. So that's why I changed my proposal to an
actual (proposed) class called "ModuleReference" which can receive lowercase
module names to return a reference to a class within a module.

Whew! This is tiring, isn't it? Eeek!  :-P

OK, so *now* I'm realizing that having module path references in your code
is just going to lead to problems anyway. If the module path changes, your
code is broken. Just like if you have hard-coded paths to files in a program
and someone moves the file. Reorganization happens often, so this is bound
to occur.

So I'm hoping we will not have to use the module paths to reference classes
in our everyday code.

Chris


-----Original Message-----
From:	squeak-dev-admin at lists.squeakfoundation.org
[mailto:squeak-dev-admin at lists.squeakfoundation.org] On Behalf Of Les
Tyrrell
Sent:	Saturday, February 23, 2002 1:36 AM
To:	squeak-dev at lists.squeakfoundation.org
Subject:	Re: [Modules] Upper case message names for accessing modules


----- Original Message -----
From: Chris Becker <chb99 at msn.com>
To: <squeak-dev at lists.squeakfoundation.org>
Sent: Thursday, February 21, 2002 1:13 PM
Subject: RE: [Modules] Upper case message names for accessing modules

> Maybe something like this would clear it up ...
>
> ellipse := Squeak modMorphic modCore modBasic EllipseMorph new.

Actually,  I would argue for something more along the following lines:

    ellipse := Ellipse new.

If you really had to, you could resort to something like:

    ellipse := MorphicEllipse new, or perhaps ellipse := EllipseMorph new.

If you allow your modules/namespaces to alias names, and have the tools to
do
this easily, then this should be a gimme.  Chances are, you have a pretty
good
idea of which Ellipse you are dealing with in your code, and if you really
really need to disambiguate it you can go ahead and give it a slightly more
restricted name.  Elsewhere, you can note that Ellipse really means "that
Ellipse morph over in the Morphic package".   Filtering patterns along the
lines of "Everything that looks like Morphic* I get from the Morphic
package"
could be a real timesaver.  The point is, you the programmer have the
flexibility to reference your globals with names that make sense in the
context of any given module.

( hats off to Stephen Pair for bringing this idea up again )

- les







More information about the Squeak-dev mailing list