This module implements (temporary) modules-as-blobs facilities. They allow the runtime creation of modules from strings and terms.
Run-time creation of modules is currently implemented by writting the module code into a unique temporary directory (using the system mktemp_in_tmp/2 predicate).
Currently they need to be deleted explicitly.
Note that this is a temporary solution before read/write stream operations can be work on in-memory objects.
Module creation requires the module name, export list, program clauses, and returns the module object (currently a path). If a module directive is specified, the export list is ignored.
?- new_modblob([(p(A) :- q(A)), (q(b))], [p/1], my_tmp_mod, ModBlob), modblob_path(ModBlob, Path). Path = '/tmp/tmp_modsfbMY9Y/my_tmp_mod.pl' ?
where the contets of /tmp/tmp_modsfbMY9Y/my_tmp_mod.pl are:
:-module(_,[p/1],). p(A) :- q(A). q(b).
Write clauses Clauses in a temporary module identified by ModBlob.
Removes the data associated to ModBlob