A colleague has found a difference between Sicstus Prolog and Poplog
Prolog, and he thinks this is a bug in Poplog prolog. I wonder if others
agree.
Prolog HELP I_O says
The goal
?- see(File).
will make ____File the current input stream, so that subsequent input will
be taken from there.
I interpret that to mean that until the next "see" or "seen" command,
predicates like get0(X) will read from File. That's how Sicstus works.
Much later in the help file it says:
It is possible to see an alternative input source within a directive,
but this has effect only for the duration of the directive: the input
stream will be reset to ____File once the directive has been executed. In
particular, a directive consisting only of a redirection, such as
:- see(user).
has no visible effect.
In fact that is also how
?-see(File).
seems to work. I.e. as soon as it returns to reading in commands
from the terminal its as if a see(user) has been obeyed.
The model suggested by the start of the HELP I_O file is that besides
the standard input and output channels there is another channel that is
read by the reading procedures and which is reset by see and seen. But
that's not how Poplog prolog actually behaves. Rather it seems to be
reset whenever the compiler has finished obeying a command. Doing it any
other way would require the prolog compiler to use different reading
procedures from those used by get0 etc.
Have I misread the help file, or is there a bug, or has Sicstus
done it wrong?
To me it seems as if Sicstus has it right and Poplog prolog has a bug,
but I am not an prolog expert. Hence this query?
Aaron
|