Quick comparison of two Namespaces proposals

Jason Johnson jason.johnson.081 at gmail.com
Tue Sep 18 16:25:31 UTC 2007


On 9/17/07, Göran Krampe <goran at krampe.se> wrote:
>
> - I personally think hierarchical namespaces is "too much". I opted for
> single level namespaces and still think that is enough.

But this is a slippery slope.  Afterall, flat wasn't enough, why
should we think 1 level would be enough forever?

> - Imports are done in your code "per Namespace" which is immensely better
> than like for example in Java where it is per class (well, per file, but
> anyway). It is still though the major difference with my proposal in which
> there are *no* explicit imports at all.

Well, the issue I have with your proposal is it isn't really a
Namespace/Package proposal, it's simply a proposal to always add your
prefixes with a ::, and add some tool support to deal with it.

In my opinion Namespaces are a complicated subject and using such a
simple method to deal with them is just sweeping the problem under the
rug for someone else.

I try to make my own solutions as simple as possible, but no simpler.
Personally, I think that if we need namespaces now there are good
examples to follow:  Lisp, Python, possibly Haskell all have good
Namespace/Package systems we could emulate.

> - I agree that shared pools theoretically could be replaced with
> Namespaces, but then we actually have imports *per class*, which I really
> don't like. You may argue, "but we already have them!" - yes, I agree, but
> I don't like them anyway and in my proposal I opted out by simply
> ignoring/not touching them. :)

What is the problem with shared pools?  That they're a kind of global
variable?  I haven't used them much myself, but personally I would
prefer a good argument for getting rid of them since the creators of
Smalltalk seem to think they were useful.

> - Your Namespaces are linked to a Package scheme, I personally would like
> to keep these concepts separate.

>From Lisp or Python terms "Namespace" and "Package" are synominous.  I
think you are talking about Package as in "an MC package", no?  That
is a package as well, but it's from a different namespace. :)  In
regards to language I don't think there is much difference between the
two except that people tend to call their thing "Namespace" if it's
extremely simple (e.g. C++'s solution) and package if it's more
complete.

> - You go hierarchical, I stayed simple and kept it on one level.

I think this is fundamentally a hierarchical issue.

> - You added an explicit import list per Namespace, I opted to not have
> imports at all.

For a complete system imports are required unless you want to be
typing the whole path out everytime, which is what we have right now
(i.e. no need to add a bunch of stuff to just end up where we are now)



More information about the Squeak-dev mailing list