[Modules] Upper case message names for accessing modules

Doug Way dway at riskmetrics.com
Thu Feb 21 06:25:44 UTC 2002


ducasse wrote:
> 
> on 18/02/02 7:42 PM, Hannes Hirzel at hirzel at spw.unizh.ch wrote:
> > (B)
> > ellipse := Module Squeak Morphic Core Basic EllipseMorph new.
> 
> With B How do I distinguish between module and classes.
> May be we should not, but in such a case why Module is needed?

Actually, "Module" should not be in the expression above, that looks like a typo.  It should be:

ellipse := Squeak Morphic Core Basic EllipseMorph new.

You can actually try this right now in a workspace in 3.3alpha and it will work.

Beating this thread into the ground a bit, I suppose if you were looking for a convenient way to access classnames with a module path, and you didn't want to use the upper-case messages, you could add a method to Array so that you could do something like:

ellipse := #(Squeak Morphic Core Basic EllipseMorph) classFromModulePath new.

Or ellipse := (#(Squeak Morphic Core Basic) moduleWithClass: #EllipseMorph) new.

Yes, it's purely a convenience method, but for something as basic as referencing a class, convenience *is* very important.

- Doug Way
  dway at riskmetrics.com



More information about the Squeak-dev mailing list