Delight

bearophile bearophileHUGS at lycos.com
Sun Sep 28 16:34:25 PDT 2008


Sergey Gromov:

> There is no main module in D.  The main() function can be in any module.

This true for Python too. What I have named conventionally "main module" is the module you call bud (or a saner D compiler able to find the necessary modules by itself) with. If you call bud with another name, then the "main module" becomes magically the new one.


> There are no specific privileges for the first module on the command 
> line except sometimes compiler derives an output name from it.

I think that's bad.


> Why don't you want to use versions instead?  For the module builders for 
> instance it could be:
> do unittests:
> bud builders -unittest -version=builders
> benchmark:
> bud builders -version=builders -version=benchmark

Don't you see something bad in what you have written? You have expressed the name 'builders' two times in your command line.
So why can't the compiler, given the line:
dmd builders
define a compile variable that's true inside builders.d and false for all the other modules.
While when you compile for example:
dmd foo
is true inside foo and false for all the other modules, including builders?

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list