[mercury-users] Self-referential data structures

Warwick HARVEY warwick at cs.mu.oz.au
Wed Nov 26 15:43:48 AEDT 1997


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

Tom Conway writes:
> I agree.

I'll just say I was surprised.  :-)

I kinda expected an abort with appropriate error message if you used the
dummy reference inappropriately, rather than a seg fault.  After all, does
map__lookup/3 (for instance) seg fault if you give it a key that's not
there?  No, it prints out an error and stops.  (At least it *used* to - and
I certainly hope it still does!)

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

I thought about this option too...

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

Indeed (I didn't think it was worth mentioning them both, since they're so
similar).  I suppose it can all be appropriately encapsulated within the ADT,
so the impact doesn't propagate too far.


P.S.  Hi Henk!  Thanks for your post - I'm still figuring out the code...
:-)

				Warwick

----------------------------------------------------------------------------
Warwick Harvey                                    email: warwick at cs.mu.OZ.AU
Department of Computer Science                        phone: +61-3-9344-9171
University of Melbourne                                 fax: +61-3-9348-1184
Parkville, Victoria, AUSTRALIA 3052     web: http://www.cs.mu.OZ.AU/~warwick



More information about the users mailing list