Two different behaviors of the same Prolog code with and without debugging

75 Views Asked by At

I am using the latets stable version 6.6.6 64 bit of SWI-Prolog for windows. The code is following:

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).

The code does boring staff: It creates a window and a picture canvas on it with height 600px. It displays a text that should disappear in 3 seconds, after 2 secs a new text appears that should disappear in 2 secs.

If I run it without debugging the first text disappears in 8 secs and that's all.

If I run with graphical debugging, the code does what it should (see the code description).

So my worries are for: why there is two different outcomes of the same code and why without debugging the code does not work as it should?

0

There are 0 best solutions below