Hans-Martin on Packages and Namespaces
Last updated at 12:39 pm UTC on 27 February 2005
IMO, the concepts of packages (separately loadable pieces of code) and namespaces (registries of named code artefacts) should be kept separate.
Both are valuable, and neither fulfills the other's role.
- have an author
- can exist in different versions
- can specify prerequisites
- can be loaded and unloaded
- can contain code loaded into different namespaces (think "class extensions")
- have a naming authority (person or institution who defines what may go into the namespace)
- can be created and destroyed in the image
- can contain code from more than one module
Of course, typical "applications" can have a package and a namespace going together, with the package author being the naming authority of the namespace. However, even for moderately complex systems I can envision several packages which are independently versioned but which define their artefacts within just one namespace.
Note: This has previously be called "Modules vs. Namespaces". After some reading, I realized that modules is a too general notion and that the different approaches to modularization of systems just cut along different planes. So it is probably valid to call all of these approaches "modularization mechanisms"