Subject: Re: Circular references

From: "Richard A. O'Keefe" <[email-masked]>
Date: Fri, 15 Sep 2000 12:24:25 +1200 (NZST)

I'm having various troubles dealing with circular references.

Cyclic terms are a big headache all over the place, and the fact that
Prolog ever failed to block them is in the "Top 3 Design Misfeatures" list.
The best way to fix your problem is "Don't do that".
Find another way to represent your information (there is *always*
a better method than cyclic terms).

  The =
	biggest problem is in trying to assert a term with a circular reference. =
	 My application is more complex, but here is a simple test:
	
	    A =3D a(A), assert(A).
	
This particular example could be handled by code:
	assert(( a(A) :- A = a(A) )).

Any cyclic term can be handled this way, by adding suitable equations
to the body.  You will find it hard to write the code that does that,
but that should make it a bit clearer why cyclic terms are a BAD THING.