Modules, units and compilation order

Alexey Egorov via Chicken-users <[email protected]> Tue, 17 Feb 2026 12:49:46 +0300
Newsgroups gmane.lisp.scheme.chicken
Message-ID <CALf3tGFgrge8ty6AGH3+eP40TNAXkBoBZL-ZOCoXnwb6bNkaPQ@mail.gmail.com>
Hi! I'm struggling with adding module support to my project. The
project consists of several files and until recently I was content
with not using modules at all. But projects gets bigger, and I already
had a couple of name clashes, so I decided to use module system, and
it is not going very smoothly.

I currently have 8 files, each of them declares itself unit, and then
I compile all of them with -c and -e flags (except for main.scm), then
link them all. Works fine. Order of compilation doesn't matter.

With modules, order of compilation starts to matter. E.g. if I want to
compile my macros.scm, which imports utils.scm, I cannot do it, if I
haven't generated utils.import.scm yet.

So, I discovered -J option of the csc and tried to employ it to
generate all imports beforehand, but even with -A (-analyze-only, stop
compilation after first analysis pass) I can't get to generate module
import file if it has unresolved dependencies.

Am I missing something? Intuitively, it seems that -J doesn't need to
resolve all imports to be able to generate import file. It only
consists of symbols, after all.

So, is it currently possible to have modules in their own units
compiled in arbitrary order? If not, can the -J option be able to
generate import files without actually resolving all dependencies?

Cheers,
Alexey.