0

我正在使用适用于 Windows 的 SWI-Prolog 的latets 稳定版 6.6.6 64 位。代码如下:

start :-
    new(Frame, frame('Test')),
    send(Frame, open),
    send(Frame, append, new(Pic, picture)),
    send(Pic, height, 600),
    send(Pic, display, new(_Ref1, text('This will disappear in 3 seconds', center, font(screen, roman, 16)))),
    sleep(3),
    send(Pic, clear),
    sleep(3),
    send(Pic, display, new(_Ref2, text('Good bye!', center, font(screen, roman, 16)))),
    sleep(2),
    send(Pic, clear).

该代码确实很无聊:它在其上创建了一个窗口和一个高度为 600 像素的图片画布。它显示一个应在 3 秒内消失的文本,2 秒后出现一个应在 2 秒内消失的新文本。

如果我在不调试的情况下运行它,第一个文本会在 8 秒内消失,仅此而已。

如果我使用图形调试运行,代码会做它应该做的(参见代码描述)。

所以我担心的是:为什么相同的代码会有两种不同的结果,为什么不调试代码就不能正常工作?

4

0 回答 0