So, would it be possible (or a good idea) to modify cons so that cons
keeps somewhere a hash for each derived file:
- the key would be made of the signature as explained above
- the value would be made of the signature of the object file.
So that when cons considers to rebuild a derived file, it would:
- compile the expected signature as usual
- check if a key exists in the hash for that expected signature
- if no -> rebuild
- if yes, compute the signature of the current object file (or
retrieve a stored value) and compare it with the value stored in the
hash.
- if the 2 signatures of the object files match -> no rebuild
- if the 2 signatures of the object files don't match -> rebuild
This way, unnecessary rebuild of derived file could be avoided.
In fact, this mechanism is very close to the mechanism used by the
memoize module. (See http://search.cpan.org/search?dist=Memoize)