On Monday, 2 February 2015 at 08:09:39 UTC, Vladimir Panteleev
wrote:
1a. rdmd and D's module system:
When you run `dmd -o- program.d`, the compiler will
automatically read all modules imported by your program, and
their imports, and so on. It does so by searching the
filesystem across its search path for matches which correspond
with D's module system, and only reads those files that are
needed.
rdmd leverages this by collecting (and caching) the list of
modules used in the program, and passing that list to the
compiler. The compiler will then compile no more and no less
than the exact set of modules transitively imported by the
program.
In contrast, Dub's default modus operandi is to blindly send to
the compiler all *.d files found in the "src" folder, whether
they're actually used or not. Not only can this be slower if
not all modules are always used, but it also won't work if the
source code contains multiple entry points, forcing you to
write complicated configuration files (i.e. do the computer's
work for it).
And this is reason why rdmd suck (in my case).
Example:
return
cast(EntityManagerFactory)Object.factory("cz.dlang.ddpa.EntityManagerFactoryImpl");
// this does not work with rdmd but works ok with dub