🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #4088

Re: retractall and backtracking

#4088
From: Chris Moss
Date: Fri, 09 Jun 1989 09:45
35 lines
1924 bytes
In article <575@hfserver.hfnet.bt.co.uk> nigel@hfserver.hfnet.bt.co.uk (Nigel Cliffe) writes:
>
>I have a problem with backtracking, and retracts that don't appear to
>happen - here is a simplified example:
...
>write_unique_foos :-
>	foo(X),
>	write(X),nl,
>	retractall(foo(X)),
>	fail.
>
>Now if the predicate "write_unique_foos" is called, then I get all three
>values for foo written, not just the two unique ones as I would expect.
>However if I trace the execution, and test the contents of the database at
>various points from the debugger then "foo(bar1)" has disappeared after the
>first call to "retractall".
>
>Can anyone explain why this happens.

Under Quintus version 2 retracts take effect immediately for any new query
started but they don't affect a query already started. This is quite a
consistent behaviour, is good semantically and avoids various inconsistencies
that would otherwise happen. Read Section 2.1 of the release notes for 
version 2.0 of Quintus.

The situation is comparable to the classic readers/writers method of ensuring
file consistency. If you have already started reading (i.e. activated a
query) then the file (relation) stays the same, but any new readers 
(activations) get the new version.

This behaviour was proposed for the Prolog standard but I gather some people 
are trying to revert to the naive method with all its inconsistencies. See
the Lindholm/O'Keefe paper in the Melbourne LP conference.

Chris Moss
Technical Details
Message-ID: <886@gould.doc.ic.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!ukc!icdoc!cdsm
References: <575@hfserver.hfnet.bt.co.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!ukc!icdoc!cdsm
From: cdsm@doc.ic.ac.uk (Chris Moss)
Newsgroups: comp.lang.prolog
Subject: Re: retractall and backtracking
Keywords: Quintus, retract, backtracking
Message-ID: <886@gould.doc.ic.ac.uk>
Date: 9 Jun 89 09:45:14 GMT
References: <575@hfserver.hfnet.bt.co.uk>
Reply-To: cdsm@doc.ic.ac.uk (Chris Moss)
Organization: Dept. of Computing, Imperial College, London, UK.
Lines: 35