Best practice and module declarations
Rory McGuire
rmcguire at neonova.co.za
Thu Jul 15 12:59:04 PDT 2010
On Thu, 15 Jul 2010 00:22:34 +0200, Jonathan M Davis
<jmdavisprog at gmail.com> wrote:
> I was wondering what the general consesus was (if there is one) on
> whether it's
> valuable to always put module declarations in each module.
>
> Obviously, if you need the module to have a name other than the file
> name, then
> you need to have the module declaration. However, is it necessarily
> desirable to
> have it when the module name matches the file name? Or would there even
> be a
> reason for it to be desirable _not_ to have the module declaration?
>
> I can't think of any particularly strong reasons to have it or not to
> have it.
> My first reaction is to just always use it, but thinking about it, I'm
> not sure
> that there's really much point if the file name and the module name
> already
> match. Does anyone have reasons why it would matter other than personal
> preference?
>
> - Jonathan M Davis
From what I remember in TDPL:
Can be used to rename a module if you have it in a different directory
structure than how you use it. E.g. implementation and "headers" in
separate folders.
Can be used to rename module when a filename is not a valid D symbol.
-Rory
More information about the Digitalmars-d-learn
mailing list