Some Basic Questions

Kirk McDonald kirklin.mcdonald at
Tue Aug 15 16:05:22 PDT 2006

Lutger wrote:
> Derek Parnell wrote:
>> No, I suggest you use a different naming convention. I would have your
>> class name start with a Capital letter and have your source file name all
>> lowercase. And if you stick to one class per file, have your filename
>> different to the class by adding a suffix or prefix. For example,
>>   module foo_m;
>>   class Foo
>>   {
>>    ...
>>   }
> Can I ask you, what is your reason for naming a source file differently 
> than the class? Does it have something to do with importing magic?

The name of the source file and the name of the class are completely 
orthogonal. They have nothing to do with each other. They may be the 
same or different as you wish. This is not Java: A source file can 
contain zero classes or as many classes as you like.

That said, it is convention to name source files and modules completely 
lower-case, and to start class names with a capital. However, the 
language does not actually enforce either of these. If nothing else, it 
is a /very bad/ idea to ever name the source file and the module 
different things, even if they just differ in capitalization.

Kirk McDonald
Pyd: Wrapping Python with D

More information about the Digitalmars-d-learn mailing list