-
- Infrastructure
- Technical
-
-
-
- Questions
-
- Organization
-
- More Labs
Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
Turning a file into a module mainly means adding the directive
:- module (moduleName, exportlist).
at the start of the file (see SWI-Prolog Manual for details).
Turning a Prolog file into a module has two implications that might change the program's semantics:
are visible outside only if accessed by explicit module qualification
(that is, as "moduleName:goal" instead of just "goal". - all metapredicates that access or manipulate prolog clauses (findall, setof, bagof, call, assert, retract, clause, ...) will by default act in the context of the module that calls them. That means, for instance, that clauses will be asserted in the new module and will not be automatically visible in the default module "user", where they had "lived" before the refactoring.
In order to determine whether the above risks might actually occurr if the core transformation is performed, some analysis is necessary. In no particular order:
In order to avoid behavioural changes, some additional transformations are possible: