[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dumping data structures with circular references.

   From: "RDP%ALAN.LAAC-AI.Dialnet.Symbolics.COM %ALAN.kahuna.DECNET.LOCKHEED.COM"@warbucks.ai.sri.com
   Date: Thu, 2 Nov 89 13:05:36 CST

   I'd like to know what people do in general to avoid the "circular
   reference" problem when using SYS:DUMP-FORMS-TO-FILE.  I would guess
   that this must have been solved many times but the documentation doesn't
   seem to have anything to say about it.  

At least you get an informative error message.  The problem used to be
infinitely more obscure.  

I deal with it by writing wrappers around the :fasd-form method.  The
wrapper removes the backpointer and puts it back after :fasd-form does
its thing (returning what :fasd-form returns, of course).  This allows
you to continue using your data structure after the dump.

Of course, your procedure that reloads the data structure from disk has
to know how to restore the backpointers.  This is easy enough for your
test case and for my real-life case, and hopefully for YOUR real-life
case as well.

IWBNI someone could devise a more general solution so we wouldn't have
to worry about it.