Module naming conventions

Bill Baxter dnewsgroup at billbaxter.com
Sun Nov 18 22:11:53 PST 2007


Sean Kelly wrote:
> Robert Fraser wrote:
>> Bill Baxter Wrote:
>>
>>> *) Long established convention (~10 years) used by Phobos
>>
>> About 6 years (2001), I think.
>>
>>> *) Established convention (~4 years) used by Tango
>>
>> Less than 1 year. Ares was around before (3 years ago, according to 
>> dsource), and also used camel case.
> 
> Actually, it didn't.  The CamelCase came to Tango from Mango, which was 
> started perhaps 4 years ago by Kris.  Ares followed the Phobos style 
> guidelines.
> 
>>> *) Fine granularity approaching one-module-per-class means D's linker 
>>> will generate smaller executables.
>>
>> Can you elaborate on this one so I don't have to read the whole Phango 
>> thread? Why is this true? And there can still be one-class-per-module 
>> (what's one-module-per-class? A typo or am I misunderstanding 
>> something?) even with a lower-case module naming convention, so that's 
>> not really an argument for camel case.
> 
> I think this may be a separate issue.  I was describing why Tango has so 
> darn many modules, which I believe came up as a general stylistic 
> difference between Phobos and Tango.

Different maybe, but there's a logical chain of implications there.

If it's good for the linker to have fine granularity modules, then it 
makes sense to put each class in its own file (when there are classes). 
  If you're going to have lots of modules with only one class, then it 
makes sense to name the modules after the class contained in some way. 
Then if module names are going to a variation on class names, you might 
as well make them exactly the same.

Though for lowercasing, I suppose you could just use a different 
convention, like put class PenIsland in module pen_island.

Put in the negative, you might say the looser convention of names like 
"std.stdio" doesn't mesh well with the current capabilities of the DMD 
linker.

--bb



More information about the Digitalmars-d mailing list