chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] separate compilation


From: F. Wittenberger
Subject: Re: [Chicken-users] separate compilation
Date: Sun, 23 Nov 2008 02:45:02 +0100

Am Samstag, den 22.11.2008, 18:38 -0500 schrieb John Cowan:
> Jörg F. Wittenberger scripsit:
> 
> > I noticed that the .import.scm files are overwritten, whenever the
> > associated .scm file is compiled.
> 
> That's because they are object files from the point of view of
> compilation; the fact that they are textual doesn't make any difference.
> 
> > This defeats separate compilation of modules.  If the (any) file holding
> > the exports where updated only if it's content really changed, it would
> > be useful in Makefiles to suppress superfluous compiler runs while
> > triggering those, which are really required.  As things are now, I can
> > either make my build depend on the files containing the exports or the
> > object files.  In any case, I'll have to compile too much.
> 
> A compiler run should depend only on source files, never on object files
> of either type; if it does, you have introduced a dependency on the order
> of compilation that shouldn't exist.  In other words, you may have to
> recompile a file if the source of some other file has changed, but never
> because the object file (.o or .import.scm) has changed.

John, you're right, as far as the dependency story between the files
goes.

But in fact, here we're trying to design a feature, which combines the
easy of one-source-file with the advantages of those languages, which
separate interface and implementation into two separate files.  Those
languages (even C) make it easy do design a build process, which does
not run compilers for no good reason.

It would be easy enough to compile the export file into memory or a temp
file and overwrite the old file only if there are differences.

This would give us both: one file, which only changes, when the actual
interface chances (the .import.scm or whatever name and type is might
have one day), and one file, which chances with the implementation (the
original .scm).  Now, within the Makefile we could make modules, which
depend on the interface depend on the .import.scm and the .o etc. depend
on the .c/.scm.

> 
> The only files that should depend on object files are executables.
> 
> > Side note: if there where any kind of file going to record the
> > last-modified-time of exports, that's perfect.  
> 
> The source file of the export is precisely what records that, which is
> why you should depend on it.
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]