Quick comparison of two Namespaces proposals
Jason Johnson
jason.johnson.081 at gmail.com
Thu Oct 4 20:34:31 UTC 2007
On 10/4/07, Göran Krampe <goran at krampe.se> wrote:
> Hi!
>
> I would actually not want that, I would want:
>
> Net::Socket
> Net::FtpSocket
> Net::TelnetSocket
Notice the prefixes?
> Ehm, noting of course that the design is bad in the first place - it
> should not be different subclasses of Sockets at all. But my point is
> still made - we should not use the word Socket for tons of different
> things.
It's an example, but something more real will come up soon enough.
> > In other words, with only one level the Namespaces end up having the
> > same "prepending prefixes" problem as classes have now.
>
> I don't think so, you can probably come up with an example - but I think
> it would be quite rare.
You just showed me one. :)
> Actually, I think the biggest reason is that we (we being we who are using
> prefixes) don't want to "pollute" the global space. And yes, we do want to
> avoid clashes - but not because it would be terrible but because we
> currently don't have mechanisms to deal with them.
And we will still need them with a one bucket namespace system for the
same reason. "Smalltalk" just becomes something a bit more narrow,
but otherwise it's the same situation.
> But my point still stands - we don't *need* a space for every package.
I didn't say we would for *every package*.
> I am not sure I caught the "confusing" part.
Because different systems call the concept different things. C++ has
something very simple and they call it a "namespace". I think
everyone else calls the concept either "package" or "module". This
may lead one to conclude that the terms mean how the given languages
implement them (e.g. since C++ namespaces are simple and Lisp's
packages are complex then namespace must mean something simple and
package something complex).
> I am not saying "They will hardly be used!" - you just said that, not me.
I didn't say you said it, but that it "seems like", in other words,
this is how it sounds to me.
> For the base classes I *do* believe that. Because we are already
> maintaining that namespace together and it is working just fine. I didn't
> mean for the whole world of Squeak.
As you said yourself, we already effectively have namespaces:
prefixes. We are not living together in harmony, we're making
namespaces the only way we can. This is what I mean, how can you
think we will have one or 2 when we don't today? We have lots.
> This is an interesting statement that tries to argue that in 5 years we
> will have much more libraries and code and that this will linearly
> increase the number of conflicts. At first sight this seems logical BUT it
> totally ignores the fact that you only get a naming conflict INSIDE AN
> IMAGE.
>
> And since the number of libraries and code in a given image is not likely
> to increase all that much (some yes, but not much) the reasoning fails.
You misunderstand me. I'm not saying in 5 years we will have vastly
more libraries. Just the ones we do have converted to namespaces.
More information about the Squeak-dev
mailing list
|