My namespace proposal described in Yet Another Try

Todd Blanchard tblanchard at mac.com
Fri Sep 21 05:35:21 UTC 2007


On Sep 20, 2007, at 8:12 PM, Ramon Leon wrote:

>> Magritte and Magma already both very nearly use the same prefix, "MA"
>> and "Ma", respectively.  It's hard for me to accept, after
>> all this discussion and effort and say Göran's finally makes
>> it into the base image, that I could very easily collide with
>> Magritte unless at least one of us renames a bunch of stuff.
>
> We use two letter prefixes because we're forced to see them and  
> type them
> constantly, with Göran's proposal, it'd be much more common to use
> Magritte:: or Magma:: as the prefix since you wouldn't be typing  
> it, it'd
> resolve naturally when you just used the short class name.  Granted  
> this
> doesn't help existing packages with short prefixes, but it'd help  
> new code.
> If it worked well, I'd sure take the time to rename my code to use it.
>

Actually, you are not forced to use two letter prefixes - you can use  
ten letter prefixes if you like.  But it would get tiresome to type  
those - unless you created export names.  How's that?  When you build  
a package, use long names.  But create a subclass of SharedPool with  
short names for all your classes bound to your classes.  So if I  
create the FlamingWicked package, I would create a  
FlamingWickedExports subclass of SharedPool with the short names of  
my classes as class variables and a class initialize method that  
initializes the elements.

FlamingPoolExports>>initialize	
	Foo := FlamingWickedFoo.
	Bar := FlamingWickedBar....

Users of my package just add FlamingPoolExports to the  
PoolDictionaries in the class definition.
No tool support required.

-Todd Blanchard




More information about the Squeak-dev mailing list