Re: Namespace Proposal
- Posted by Travis Beaty <travisbeaty at arn.net> Jun 22, 2001
- 414 views
Howdy y'all! Here, I feel that I must agree with Derek that the "namespace" idea would be best. The biggest reason for this would be uniformity, especially among any future libraries which would implement the namespace system. For instance, suppose that win32lib.ew used the namespace "win." Now then, the name for this namespace would be set within the include file itself, not within the user's code. This would make other people's code more readable, in my opinion, because it would "standardize" the win namespace with win32lib.ew. For instance, with the namespace being declared in the win32lib.ew include file, anyone familiar with that library would be able to see its use in Mr. Jones' program: include win32lib.ew sequence theVersion theVersion = win.getWin32libVersion() If the user declares the namespace, the user might declare such a namespace as "win," or "win32", or "winnythepoo." That, I feel, would make it much harder for others to read the code. The only problem I can see with namespaces is that, in a way, it only jacks the conflict up to a higher level. What if file A declares the namespace "myFile," and file B declares the namespace "myFile"? Will this be considered a naming conflict, or will file B's symbols be added to the namespace previously created by file A? Another question would be scoping. In the following example, what would be the result? -- myLib.ew include myFirstLib namespace myLib include mySecondLib.ew -- end of code Now, let's assume that the only namespace declared is in myLib. Would symbols in myFirstLib be in the global namespace and symbols for mySecondLib be in the myLib namespace? If mySecondLib has the namespace "Second" declared, would "Second" therefore be a subset of the "myLib" namespace? I fear there would be a lot of hashing out syntax using this setup. All things considered, I know I would be a lot more comfortable using the namespace system, and I do feel that, as much trouble as it will be to setup and implement, it would be the most readable of the proposals I've seen thus far, as it would provide with a namespace standarization of libraries -- when the reader of my code sees the "win" namespace, or the "obj" (objecteu(?)) namespace, the reader knows exactly where it's coming from, without hesitation. With Best Regards, Travis Beaty Claude, Texas.