[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
automatic dependency generation was: Re: [Axiom-developer] lattice
From: |
Ralf Hemmecke |
Subject: |
automatic dependency generation was: Re: [Axiom-developer] lattice |
Date: |
Fri, 11 Aug 2006 10:25:07 +0200 |
User-agent: |
Thunderbird 1.5.0.5 (X11/20060719) |
A project might be to have the compiler output spad dependencies --
just like GCC is able to output dependencies, which greatly
facilitates the tedious part of writing Makefiles and keeping them in
sync; Automake uses it.
That would be a nice feature, but even if it probably will not happen
that often, Aldor's "extend" might complicate that process (I don't say
it makes it impossible).
Look at the files given below.
My intention is to compile them via
--aldor aaaf1.as; ar rv libmyprj.al aaaf1.ao; rm aaaf1.ao
--aldor -lmyprj aaaf2.as; ar rv libmyprj.al aaaf2.ao; rm aaaf2.ao
--aldor -lmyprj aaaf3.as; ar rv libmyprj.al aaaf3.ao; rm aaaf3.ao
Assume the compiler first gets aaaf3.as. It sees either #library or
"extend" and gives up, since no library is existing.
So it takes aaaf2.as and delays it for the same reason.
It can, however, compile aaaf1.as. Fine. But it really has to produce
the .ao file and the library in order to be able to go on. So it is not
just a lightweight compilation without producing code.
Then it starts again by looking at aaaf3.as. No compilation possible,
since the function "bar" cannot be found. Now, is this just because
there is a spelling mistake in "bar" or because the compiler has not yet
seen aaaf2.as? OK, the compiler delays aaaf3.as and compiles aaaf2.as
(with which options?). That works. Again the compiler must produce code
so that aaaf3.as can compile.
One can easily setup several more extensions and finding the
dependencies just explodes combinatorially.
A simple workaround would be to introduce a CONVENTION. One library may
only extend a domain once. If there is need to extend another time, then
that should happen in another library. In this way one gets a (more or
less) natural layered structure and the library structure becomes easier
to understand for a human.
There already happen several "extend"s in libalgebra (distributed with
Aldor) and it is quite hard to find your way through the sources. One
constantly has to check what the Makefile says.
Ralf
---BEGIN aaaf1.as
#include "aldor"
define CatA: Category == with {foo: () -> ()}
Dom: with {foo: () -> ()} == add {foo(): () == {}}
---END aaaf1.as
---BEGIN aaaf2.as
#include "aldor"
#library MyPrj "myprj"
import from MyPrj
extend Dom with {bar: () -> ()} == add {bar(): () == foo()}
---END aaaf2.as
---BEGIN aaaf3.as
#include "aldor"
#library MyPrj "myprj"
import from MyPrj
extend Dom with {ans: () -> ()} == add {ans(): () == bar()}
---END aaaf3.as