Quick comparison of two Namespaces proposals

Michael van der Gulik mikevdg at gmail.com
Mon Sep 17 22:14:59 UTC 2007


Hi Göran, all.

On 9/17/07, Göran Krampe <goran at krampe.se> wrote:
>
> 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.



We already have hierarchical categories in Squeak. For example,
"Kernel-Chronology-Tests". I'm making hierarchical namespaces available, but
you don't have to nest things more than one level deep if you don't like
that style.

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



Meh. I like the dots; they look tidy. If you can give me a good reason not
to use them then I'm happy to change.


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



To be honest, I've never really used shared pools, so I don't know much
about how they're used. In my conversion (categories->namespaces) code, I
turn a shared pool into a sub-namespace of the class they appear in (ooh...
that could be a bug...). I haven't tested this yet. For the meanwhile I've
left class pools as they are.


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



(background for people: Package is a subclass of Namespace and forms the
root of a namespace hierarchy).

Why is this a bad thing? Could you be more specific?

If anybody is interested, an old and very buggy version is available on the
PackageUniverses. Install the "NamespacesBrowser" package and then evaluate
"NamespaceBrowser example" (IIRC?) to open it. Newer versions which work
better are available at http://www.squeaksource.com/SecureSqueak.

Currently, I can file out and file in a package, manage them, create new
classes save methods, open a workspace which only resolves globals from a
particular namespace, and create instances of objects in those namespaces.

Gulik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20070918/6b70f00e/attachment.htm


More information about the Squeak-dev mailing list