Module naming conventions
Walter Bright
newshound1 at digitalmars.com
Mon Nov 19 01:08:40 PST 2007
Bill Baxter wrote:
> Is this list complete?
>
> Convention LC: All package module names are lower case all the time.
> Example: import foo.bar.baz;
> Pros:
> *) Long established convention (~10 years) used by Phobos
>
> *) Differentiates module names from class names.
> Like class "Stream" in module "std.stream
>
> *) Related: prevents redundancy in fully qualified names
> (std.stream.Stream, not std.Stream.Stream)
>
> *) Easy-to-remember rule ("just use lowercase") prevents naming errors
> slipping through the cracks on case-agnostic Windows.
This is not a big issue, but an irritation: sometimes, I see code
developed on windows that names a file like: "Foo.h", but then
#include's it with "foo.h". It all works fine until one tries to port
the code to Linux. Worse, sometimes you'll see the reverse problem,
where there's a Foo.c and a foo.c on Linux and you have to port it to
windows.
Having all file/module/package names in lower case is just a no-brainer
way to avoid this issue.
I'll also confess I just don't like filenames with caps, underscores, or
special characters in them, nor do I like long filenames. I have some
image programs that insist on writing out .JPG files, and if I forget to
rename them to .jpg before ftp'ing them to the web server, they don't
work. Using all lower case, simple filenames, minimizes problems moving
the files between systems.
I'm surprised nobody has asked why D doesn't simply enforce module names
to be in all lower case <g>. The answer is the language shouldn't
enforce stylistic issues, it would be as if { } style were enforced.
Many people are turned off from Python because it enforces an indenting
style.
More information about the Digitalmars-d
mailing list