From jan@swi.psy.uva.nl  Fri Sep 15 17:38:27 2000
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id RAA22803;
	Fri, 15 Sep 2000 17:38:27 +0200 (MET DST)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id RAA25423;
	Fri, 15 Sep 2000 17:38:44 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: Paul Singleton <p.singleton@keele.ac.uk>, prolog@swi.psy.uva.nl
Subject: Re: Circular references
Date: Fri, 15 Sep 2000 17:30:53 +0200
X-Mailer: KMail [version 1.0.28]
Content-Type: text/plain
References: <200009150024.MAA17632@atlas.otago.ac.nz> <39C2395F.92A20022@keele.ac.uk>
In-Reply-To: <39C2395F.92A20022@keele.ac.uk>
MIME-Version: 1.0
Message-Id: <00091517384300.25079@gollem>
Content-Transfer-Encoding: 8bit

On Fri, 15 Sep 2000, Paul Singleton wrote:
>"Richard A. O'Keefe" wrote:
> 
>> Cyclic terms are a big headache all over the place,
>
>For Prolog implementors maybe, but surely not intractable; and for
>application programmers surely they needn't be a headache at all?
>
>(I guess garbage collection is a big headache for implementors,
>and I'm thankful that it's theirs and not mine :-)

Actually the garbage collector is the simplest part and it works
on cyclic terms without knowing about them :-)

The problem is all functions that walk along terms have to be
aware of this.  Most naturally these are written as simple
recursive functions.  Like that they are short and simple to
read.  Over time, in SWI-Prolog most of these functions now
avoid the recursion on the right-most argument, so very
deep lists and other right-recursive structures can be handled
with limited stack-space.

True though that the current approach of a few functions dealing
with it, but most leading to a big crash isn't the most elegant.

	--- Jan

