So far I have lived with several hacks:
Up to 0.7 - time before module
SICStus always had ensure_loaded/1 beginning of Quintus, which was not only a directive (as in ISO), but also a command. So I wrote my own make predicate, simply listing all the files:
l :- ensure_loaded([f1,f2,f3]).
After graduation l. only those files that were changed at this time were rebooted.
Perhaps I could write it the same way - I would read the middle (sic):
l :- \+ ( source_file(F), \+ ensure_loaded(F) ).
3.0 - Modules
With modules, things have changed a bit. On the one hand, there were files downloaded manually into the module, for example ensure_loaded(module:[f1,f2,f3]) , and then those that were pure modules. It turned out that there is a way to globally ensure module loading - without interfering with the actual import lists, simply by specifying use_module(m1, []) , which again is a directive and a command. A point is an empty list that made the module double-check and reload, but thanks to empty lists this operator could be done everywhere.
In the meantime, I am using the following module:
:- module(make,[make/0]). make :- \+ ( current_module(_, F), \+ use_module(F, []) ).
This works for all βlegitimateβ modules β and until the interfaces change. I still don't like this verbosity: for each module being tested and unmodified, there is one line of message. Therefore, I get a page with such messages when I just want to check that everything is updated. Ideally, such messages will only be displayed if something new happens.
| ?- make. % module m2 imported into make % module m1 imported into make % module SU_messages imported into make yes | ?- make. % module m2 imported into make % module m1 imported into make % module SU_messages imported into make yes
the improved version takes into account @PerMildner's note.
Other files may be reloaded if they are associated with only one module. In particular, uploading files to the user module is enabled as .sicstusrc . See the link above for the full code.
% reload files that are implicitly modules, but that are still simple to reload \+ ( source_file(F), F \== user, \+ current_module(_, F), % not officially declared as a module setof(M, P^ExF^ExM^( source_file(M:P,F), \+ current_module(M,ExF), % not part of an official module \+ predicate_property(M:P,multifile), \+ predicate_property(M:P,imported_from(ExM)) ),[M]), % only one module per file, others are too complex \+ ensure_loaded(M:F) ).
Note that in SWI, do not ensure_loaded/1 and use_module/2 compare file modification dates. Therefore, both of them cannot be used to ensure that the latest version of the file is downloaded.