[mercury-users] Self-referential data structures

Thomas Charles CONWAY conway at cs.mu.oz.au
Wed Nov 26 13:32:04 AEDT 1997


Richard A. O'Keefe, you write:
> I am deeply unhappy about this.

I agree.

As a solution to warwick's problem I'd advocate
either using a maybe(key(T)) or having two kinds
of recored stored in the store.
eg

:- type record
	--->	undefined
	;	record(
			....,
			key(record), % next
			key(record)  % prev
		).

You're right this does require a runtime check,
however, I'd much rather some runtime checks than
core-dumps.

On reflection, that amounts to moving the maybe from in the record
to around the record - 6 of one, ....

Thomas
-- 
ZZ:wq!
^X^C
Thomas Conway               				      conway at cs.mu.oz.au
AD DEUM ET VINUM	  			      Every sword has two edges.



More information about the users mailing list