[Prev][Next][Index][Thread]

Re: A basic question: defining modules and libraries



> From: Eric Gouriou <egouriou@cup.hp.com>
>
> One thing I do _not_ want (I fact I want not to see it) is usage
> of the hierarchical namespace capabilities inside a module.
> Please, no com.pobox.ego.collections.map-to-table
> or com/pobox/ego/collections/map-to-table
> or com/pobox/ego/collections::map-to-table
> I would prefer to have these capabilities restricted to the "define module"
> level. "prefix:" and "rename:" is really all I want to see for the language
> namespace [*].

Multi-level namespaces are confusing: I've just faced that with an
EXPERIENCED C++ programmer trying to change from MFC to ANSI exceptions.
Rememember, you can only ever program at one level at one time, so
multi-layered access (as in C++) or flat access with mangled names
(as.in.java) are an added complication.
Long, flat name hierachies are less confusing and easier to manage than
deep, twisty ones. I hate having to include javax.swing.borders in programs
I didn't think needed them, and newbies I've taught look deeply hurt when I
tell them that including java.awt.* doesn't include java.awt.image.*.

> [*] Ok, I am not completely satisfied with "rename:" and co. :
> Another change I would like is the ability to rename on export. I guess I
> know why this is not provided (so that 2 different names on import can never
> refer to the same "thing" ?), but I wished at some point that I could
> rename the content of a library/module once and use this for multiple
> imports.

Rename on export is possibly counterintuitive, but the same effect can be
achieved by creating the publicly accessed bindings in a separate interface
library, importing your definitions library into the interface library, then
binding the definitions to the interface library's exports.

- Rob.




References: