Re: private include files
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Oct 12, 2004
- 405 views
Derek Parnell wrote: > > Has anybody got any thoughts about extending the 'include' system so > that anything included can only been 'seen' by the file that included it. > > For example, if we have ... > > private include abc.e > > then only the file that has that line can see the 'globals' that are > defined inside "abc.e". So if another file wants to see them they also > have to explictly include "abc.e". Further more, if "abc.e" has > already been included without the private qualifier, that will no cause > any conflicts. > > This is just a quick spur-of-the-moment thought, so it probably has > got issues with it. > > It would certainly help me with many of the projects I'm working on. This actually sounds like it should be really easy to implement on top of the namespace improvements that Rob is adding for 2.5--see my modified interpreter. It only tries to resolve conflicts, but considers also indirectly included files. I would think that adding something like 'include private' should allow Rob to flag the file, and just alter the namespace search tree. The only real benefit I see from this is not having included files in libraries polluting the user's namespaces, which could definitely be important for when two libraries have conflicting names in lower level includes. Matt Lewis