Delight

Sergey Gromov snake.scaly at gmail.com
Sun Sep 28 16:53:51 PDT 2008


Sun, 28 Sep 2008 19:34:25 -0400,
bearophile wrote:
> 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.

What if a makefile builds all modules by "dmd -c module.d" and then 
links object files together?  That's how bud works.  Which module is 
"main" then?

I'll tell you, it's not the compiler's task.  Compiler is not a build 
system.  Recursive building is a special case for simple tools, and in a 
large project you do want an incremental build.

But a build system can definitely do that.  Bud could do that.  Bud 
could define a -version=builders, or define -version=mainmodule when 
compiling the first module in the chain.

> > 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.

I'd definitely better specify a module name twice than modify module 
source every time I want to benchmark.


More information about the Digitalmars-d-announce mailing list