Make/0 and delete_file/1

I’m using: SWI-Prolog version 8.1.12

I load a program “load.pl” containing a directive “:- ensure_loaded(a).” where a.pl contains a single clause, say “a(a).”.
When I modify a.pl in my editor (e.g. to “a(b).”) and call make/0 in my top-level, my prolog program gets updated as expected.
If I then delete file a.pl (e.g. delete_file(‘a.pl’).) and then call make/0, my program does not change, and no error is thrown.
Could you please help to clarify, what should be the expected behaviour of make/0, when one of the loaded files goes out of existence?

2 Likes

Make/0 reloads edited files. It isn’t a full consistency mechanism between the file system and the Prolog database. In many places that is also impossible as removing things that used to be there and in particular side effects thereof are hard to track and undo.

Possibly it should once be described what you can and cannot expect from make/0. Deleting files doesn’t seem to be a very common task during program development to me. You could make the file empty, run make/0 and delete it :slight_smile: There is also unload_file/1, but that too has its limitations.

1 Like