Quick comparison of two Namespaces proposals

Göran Krampe goran at krampe.se
Mon Sep 17 11:03:39 UTC 2007


Hi folks!

I just read through Michael van der Gulik's page:

http://gulik.pbwiki.com/Namespaces

Just stumbled over it btw, and I have only read it once and wrote down
some notes compared to my own little "venture" in this area:

http://swiki.krampe.se/gohu/32

Which I like to call "Prefixes Improved" perhaps. Anyway, here goes and
this is mainly addressed to Michael btw.

Namespace comments:

- I personally think hierarchical namespaces is "too much". I opted for
single level namespaces and still think that is enough.

- I personally don't like the "." notation for namespaces, especially
since we already use "." for statement separation. I still think "::" is
the best I have seen, although granted - this is a tiny, tiny detail.

- 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.

- 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. :)

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

So... to sum it all up:

- You also bind at compile time just like globals are bound now (and just
as in my code). No difference.
- You also reify the namespaces as instances of Namespace, as I do. No
difference, though you intend to nuke SystemDictionary - I don't.
- You also have a Dictionary protocol on the Namespaces enabling normal
dynamic lookup just as I have. Kinda normal if you reify them as objects
of course.

But...

- You go hierarchical, I stayed simple and kept it on one level.
- You use ".", I use "::".
- Your code use *both* qualified names (long with dot-notation) and non
qualified names (short), I *always* use qualified names in the source and
only let the tools "render" them short (or accept writing them short) when
they are indeed unique or when the user has a policy that allows a lookup
- like for example resolving by default to "local names" (in the same
Namespace).
- You added an explicit import list per Namespace, I opted to not have
imports at all.
- You coupled Namespaces with Packages, I did not at all go there.

So the big differences are the two last ones - Explicit import lists vs my
approach of no-imports-render-and-accept-short-names and mixing it with a
package concept vs not doing that. :)

regards, Göran




More information about the Squeak-dev mailing list