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

查看:118
本文介绍了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.

PS.我无法在注释中获取代码格式,因此将其放在此处:例如,为什么make/0需要防止"user"作为current_module/2中的File:

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天全站免登陆