4.3.4.11 Initializations

A directive

:- initialization :Goal.   ISO

in a file appends Goal to the list of goals that shall be executed after that file has been loaded.

initialization/1 is actually callable at any point during loading of a file. Initializations are saved by save_modules/2 and save_program/[1,2], and so are executed after loading or restoring such files too, in input order.

Goal is associated with the file loaded, and with a module, if applicable. When a file, or module, is going to be reloaded, all goals earlier installed by that file, or in that module, are removed first. See mpg-ref-initialization.


Send feedback on this subject.