🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1356

Problem - interaction of consult/1 with see/1 and seen/0.

#1356
From: dave8
Date: Wed, 31 Oct 1990 11:34
72 lines
3206 bytes
I have run into a problem that occurs with the implementations of Prolog that
we have. When consulting, if see/1 and/or seen/0 is called inside the file
being consulted (yes, I actually wanted to do this in a test program!), the
Prolog concerned switches, after finishing with the directive in which
"see( File )" or "seen" occurs, to consulting "File" or "user" respectively.

Implementations which do this are C Prolog 1.5a and SB Prolog 3.1, and POPLOG
Prolog Version 11 for see/1, but this seems O.K. with seen/0 (however there
appear to be other problems with the behaviour of see/1 and seen/0 in POPLOG
Version 11).

The implementations that have this problem/annoying feature make use of
see/seeing/seen in the code for consulting, and that is where the problem
arises (at least in C Prolog, it is). They could be hacked so that consulting
does not make use of these (given that you have the source code).

The following programs, in three files, should demonstrate whether an
implementation has these problems or not - consult(seer1) and consult(seer2).       

------------------------------------------------------------------------------

% File:	seer1

:- write( 'Test whether use of see/1 affects consulting a file.' ) , nl , nl .

:-
  seeing( R )
, write( 'Currently seeing "' ) , write( R ) , write( '".' ) , nl
, File = 'seer.in'
, see( File )
, seeing( F )
, write( 'Now seeing "' ) , write( F ) , write( '".' ) , nl
, write( 'If you are back at the top level after the message' ) , nl
, write( '  In "' ) , write( F ) , write( '".' ) , nl
, write( 'your Prolog has the consult/see interaction problem/annoying feature.') , nl
, write( 'Issue "[ seer1 ] ." (again) to continue consulting this file.' ) , nl
.

:- write( 'This is the end of seer1.' ) , nl .

------------------------------------------------------------------------------

% File:	seer2

:- write( 'Test whether use of seen/0 affects consulting a file.' ) , nl , nl .

:-
  seeing( R )
, write( 'Currently seeing "' ) , write( R ) , write( '".' ) , nl
, File = 'seer.in'
, see( File )
, seen
, seeing( F )
, write( 'Now seeing "' ) , write( F ) , write( '".' ) , nl 
, write( 'If you get a "| " prompt (or in the case of SB Prolog, no prompt at all)' ) , nl
, write( 'your Prolog has the consult/seen interaction problem/annoying feature.') , nl
, write( 'Issue the directive ":- see( seer2 ) ." to continue consulting this file.' ) , nl
.

:- write( 'This is the end of seer2.' ) , nl .

------------------------------------------------------------------------------

% File:	seer.in

:- write( 'In "seer.in".' ) , nl .

------------------------------------------------------------------------------

Any comments?

Dave Sherratt		Probably dave8@uk.ac.liv.cs.and
Technical Details
Message-ID: <1990Oct31.123459.3754@and.cs.liv.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!jarthur!uunet!mcsun!ukc!mucs!liv-cs!dave8

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!jarthur!uunet!mcsun!ukc!mucs!liv-cs!dave8
From: dave8@and.cs.liv.ac.uk
Newsgroups: comp.lang.prolog
Subject: Problem - interaction of consult/1 with see/1 and seen/0.
Message-ID: <1990Oct31.123459.3754@and.cs.liv.ac.uk>
Date: 31 Oct 90 11:34:59 GMT
Organization: Computer Science, Liverpool University
Lines: 72