[xcvb-devel] Why (module... ) must be specified in every file?

Faré fahree at gmail.com
Sun Oct 25 15:14:47 UTC 2009


2009/10/24 Anton Vodonosov <avodonosov at yandex.ru>:
> Why in XCVB (module... ) must be specified in every file?
>
> What makes it insufficient to just list the files in the build.xcvb
> (e.g. compiling them in the order they are listed)? Desire to
> parallelize the compilation (not total order, in contrast to
> :depends-on list in build.xcvb)?
>
> Is the (module... ) in every file optional? What will happen
> if I leave only :depends-on list in build.xcvb and remove all
> the (mudule... ) in separate files?
>
That's kind of a FAQ, so I probably should answer it in the README.
Here's more or less what I'll add to it...


Why can't module declarations be moved to a central file?
=========================================================

The reason why there needs be a module in every file is that
(at least in the current version of XCVB) is that we build using Make,
which uses change detection at the file resolution (using timestamps),
to determine whether or not to recompile object files.

The failure scenario is what happens when you modify the dependencies
of a Lisp file in a way that changes its semantics
(e.g. a missing macro, special-variable or package declaration, etc.,
may cause an error in one case, not the other).
If you want reliable deterministic compilation (the goal of XCVB),
then you want to recompile any time such dependency modification happens.
If you put all the dependencies in a central file, then
whenever the central file is modified because a new file
was added or its dependencies modified,
then everything will have to be recompiled.
Or if you may trust modifications to the central file to not matter,
and experience subtle failures.

Note that recompiling based on file-contents instead of file timestamp
would have the same issue. The issue is the resolution of change detection.
The solution that would allow to reconcile reliable incremental compilation
with a centralized dependency definition is what in the XCVB TODO file
I called "Exploded File Dependencies": for the sake of detecting changes,
explode the centralized dependency file into one file per Lisp module,
with each per-module exploded bit containing all the dependency information
about that module, and only that information. It's by no means impossible,
but it's just something painful and non-trivial that hasn't shown anywhere
near the top of my TODO list yet.

[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
There is no such thing as philosophy-free science; there is only science
whose philosophical baggage is taken on board without examination.
	-- Daniel C. Dennett, Darwin's Dangerous Idea




More information about the xcvb-devel mailing list