Squeak and Namespaces

J J azreal1977 at hotmail.com
Fri Dec 1 17:24:45 UTC 2006


>From: "Ramon Leon" <ramon.leon at allresnet.com>
>Reply-To: The general-purpose Squeak developers 
>list<squeak-dev at lists.squeakfoundation.org>
>To: "'The general-purpose Squeak developers 
>list'"<squeak-dev at lists.squeakfoundation.org>
>Subject: RE: Squeak and Namespaces
>Date: Thu, 30 Nov 2006 15:03:18 -0700
>
> > Hi ramon
> >
> > The point that andreas raised is valid. My question is what
> > do namespaces really bring us?
>
>They would let me type User instead of SSUser, SPUser, KTUser, FAUser, and
>if multiple User classes were detected, they'd ask me which one I meant.
>And if one was in the current package, it could assume I meant that one and
>not have me think about the prefix.
>

Ok.

> > So conclusion simple namespaces do not help avoid clashes.
>
>Yes they do.
>

What (I think) he is saying is:  Most people are prefixing anyway (I always 
do), so if you get a clash then you probably tried to make another SPUser.  
So just putting a couple of colons between SP and User isn't going to save 
you in that case.

>Manually prefixing classes to prevent name clashes, and being forced to use
>those long names when the tools could do it for us, and hide it from us in
>the browsers.
>

It isn't going to hide it from you.  It will hide the prefix *so long as no 
other class in the system has that name*.  As soon as *one* duplication 
happens *all* ambiguous classes will be fully prefixed in the source code.  
In the entire image.

And we can't do it the way you suggest anyway (well we could but it would be 
even more complicated) because if the classes are fully qualified every time 
(they are) and the browser hides all but the actual class every time (it 
does not) then how do we know from looking at someone else's code which 
actual class they are talking about?  Seeing colons is the indicator that 
there are two or more classes in the image with the same base name.

>And again I'll say, it's a tiny fix that automates something that we do
>manually now anyway, and is a pain in the ass.  I don't like prefixing my
>class names, it's ugly.  I pump objects across web services to .Net, where
>my class names are nice and pretty and simple, because .Net supports
>namespaces, yet I'm forced to uglify them on the Squeak side because I 
>can't
>name a class something simple in Squeak and feel even mildly safe about
>doing so.
>

For you it's ugly.  I don't notice it at all (so far).  So what is also 
obvious from the traffic on this thread is that some people want it and some 
people don't.  So to me that means it should be a loadable module for those 
who want it.  And it is.

One thing we could think about here is to make some kind of automated tool 
to switch between the two so that we could all be happy.  If you make a 
package that uses namespaces and I load it from squeakmap my system could 
automatically turn your namespaces into prefixes and vice versa (ok, this 
part is hard, but we could just make it manual on package upload).

_________________________________________________________________
MSN Shopping has everything on your holiday list. Get expert picks by style, 
age, and price. Try it! 
http://shopping.msn.com/content/shp/?ctId=8000,ptnrid=176,ptnrdata=200601&tcode=wlmtagline




More information about the Squeak-dev mailing list