Phango

John Reimer terminal.node at gmail.com
Sun Nov 18 18:54:49 PST 2007


I actuallBill Baxter wrote:
> torhu wrote:
>> Lars Ivar Igesund wrote:
>>  >> Mixed case package/module names are avoided because there needs to 
>> be a
>>>> 1:1 correspondence between file names and package/module names, and not
>>>> all file systems are case sensitive (like FAT32 and NTFS, for a couple
>>>> widely used examples).
>>>
>>> As I said elsewhere in the thread, other FS _are_ case sensitive, and 
>>> thus
>>> you need to be aware of which case you use in either case, rendering the
>>> argument moot. Early on in D history, I encountered several cases of
>>> modules being saved on Windows, then not working on Linux with their
>>> intended module names due to this. And this can only happen if the 
>>> Windows
>>> programmer typed in a file name with upper case letters, even though the
>>> module name was all lower case.
>>>
>>
>> I believe Walter's point is that "all package and module names are 
>> lower case" is a simple rule that will help us avoid this problem, 
>> given that everyone does their best to adhere to the rule.  I don't 
>> know how much it matters, since I've never run into the problem 
>> myself.  But I just tried it, and it shouldn't be hard to track down 
>> the problem based on the compiler's error messages.  Not a big deal 
>> either way, it seems.
> 
> There is another issue.  Often a module has basically only one main 
> class in it.  If the main class is called Foo, and that's all that's in 
> the module, some version of "Foo" is the logical name for the package 
> too.  But then if you use fully qualified names you end up with 
> Package.Foo.Foo when referring to the class in the module, which just 
> look *so* silly that it's easy to forget the second Foo.  But 
> package.foo.Foo looks more reasonable, since it's clear the second to 
> last "foo" is not a class name.


I actually think both package.foo.Foo and package.Foo.Foo look bizarre. 
  I've always disliked this part of D.  In that light, I think it really 
is more a shortcoming of the way D does namespaces.  Tango just tries to 
work around this (for good or bad... there's seems little choice in the 
matter: I believe tango developers and others haggled over this and 
other issues long and hard in the past: it wasn't an easy decision).

I'm not sure what might be a good solution to these problems without 
"fixing" D. Maybe a more C++ style (horrors!! did I say that?!) would be 
useful in differentiating module namespace from class?  I'm not sure... 
but that would mean a another D spec change:

such as

package.foo::Foo

as a reference to class Foo (or whatever other symbol one wants to specify)

or package.foo::

as an implied reference to whatever symbol has the same name as module 
name... in this case "foo".  If module name "Foo" is capitalized, 
therefore, the class or symbol with "Foo" would be selected.

Just some thoughts,

John



More information about the Digitalmars-d mailing list