When building reusable components I create a set of classes that work together to accomplish some larger goal and put them all in a lvlib. Sometimes some of those classes are optional--they are not required by the library for it to work but they can make it easier for users to use the library for certain tasks. These optional classes belong in the same namespace as the library. One behavior of libraries is that they load all inner libraries. When the inner library is a class all the class member vis are loaded, which wastes time and consumes resources when the classes aren't needed.
My current options are:
- Don't include the classes in the library. Consequence: I run a higher risk of name collisions and there's no continuity.
- Put each optional class in its own independent library. Consequence: Namespace pollution and a reliance on an arbitrary convention to figure out what libraries should be used together.
- Put the optional classes in the library. Consequence: Resources are used needlessly.
Usually I do the last option as it provides a more cohesive user experience. I wish I didn't have to. An lvlib is a functional grouping of code. A namespace is a logical grouping of code.
To be explicit, I would like to be able to define namespaces for each library such that:
- I can have a single namespace that crosses multiple lvlibs.
- I can have multiple namespaces within an lvlib.
- I can add libraries to a namespace without rebuilding all the libraries in the namespace.
- Loading a component with a specific namespace doesn't automatically load all sub-namespaces.
Futher,
- I'm not requesting the ability to separate a single class into multiple namespaces, nor do I think that's a good idea.
- I don't mind the class name being part of the fully qualified namespace.