[Modules] Upper case message names for accessing modules

Bert Freudenberg bert at isg.cs.uni-magdeburg.de
Mon Feb 25 11:03:57 UTC 2002


On Mon, 25 Feb 2002, Henrik Gedenryd wrote:

> That is why you can use aliases for external modules,
> e.g. you'd declare that your module depends on #(Squeak Morphic), and that
> this module should have the alias Morphic inside your module.
> 
> so in the dependencies (the "interface" of the module):
> 
>     ... externalModule: #(Squeak Morphic) alias: #Morphic ...
> 
> and in your code,
> 
>     morph _ Morphic Component new
> 
> to distinguish it from the Component class in the super-meta-reflective
> programming code you also depend on:
> 
>     ... externalModule: #(Project FancyMetaProgramming) alias: #MetaSystem
> ...
> 
>     model _ MetaSystem Component new
> 
> I think this is acceptable, even probably preferrable to other solutions
> IMHO.
> 
> On the same note, using prefixing, i.e. always using Morphic Component
> instead of just Component, probably leads to less brittle code, since you
> are always explicit and clear about where you are taking a name from. Just
> "blindly" using imported names from all over can lead to really confusing
> bugs.
> 
> If people don't want to have to declare aliases all the time, then the name
> of the last module in the path could be allowed as a default, ie. #(Squeak
> Morphic) would allow Morphic as an alias by default, but perhaps that is not
> worth the potential confusion.

Well, it would allow for backwards-compatibility. There's a lot of code
out there, even good tutorials that should not have to be rewritten. It
should suffice to tell the newbies to "import the Morphic module first"  
and all is fine.

-- Bert




More information about the Squeak-dev mailing list