SICStus 的 make/0 功能 [英] make/0 functionality for SICStus

查看:15
本文介绍了SICStus 的 make/0 功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何确保所有模块(最好还有所有其他已加载或包含的文件)都是最新的?发出 use_module(mymodule) 时,SICStus 会比较文件 mymodule.pl 的修改日期并重新加载它(如果更新).此外,include-ed 文件将触发重新编译.但它不会重新检查 mymodule 使用的所有模块.

How can I ensure that all modules (and ideally also all other files that have been loaded or included) are up-to-date? When issuing use_module(mymodule), SICStus compares the modification date of the file mymodule.pl and reloads it, if newer. Also include-ed files will trigger a recompilation. But it does not recheck all modules used by mymodule.

简而言之,我怎样才能获得与 SWI 通过 make/0 提供的类似的功能?

Brief, how can I get similar functionality as SWI offers it with make/0?

推荐答案

SICStus Prolog 中没有任何内容提供这种功能.

There is nothing in SICStus Prolog that provides that kind of functionality.

一个大问题是当前的 Prolog 太动态了,除了非常简单的情况外,像 make/0 这样的东西无法可靠地工作.使用术语扩展、加载期间执行的目标(包括文件加载目标,这是常见的)等功能,不可能知道如何可靠地重新加载文件.没仔细看,想必SWI Prolog中的make/0也有同样的问题.

A big problem is that current Prologs are too dynamic for something like make/0 to work reliably except for very simple cases. With features like term expansion, goals executed during load (including file loading goals, which is common), etc., it is not possible to know how to reliably re-load files. I have not looked closely at it, but presumably make/0 in SWI Prolog has the same problem.

我通常只是重新启动 Prolog 进程并再次加载主"文件,即加载我需要的所有内容的文件.

I usually just re-start the Prolog process and load the "main" file again, i.e. a file that loads everything I need.

附注.我无法在注释中获得代码格式,所以我把它放在这里:示例为什么 make/0 需要防范用户"作为来自 current_module/2 的文件:

PS. I was not able to get code formatting in the comments, so I put it here instead: Example why make/0 needs to guard against 'user' as the File from current_module/2:

| ?- [user].
% compiling user...
| :- module(m,[p/0]). p. end_of_file.

%  module m imported into user
% compiled user in module m, 0 msec 752 bytes
yes
| ?- current_module(M, F), F==user.
F = user,
M = m ? ;
no
| ?-

这篇关于SICStus 的 make/0 功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆