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

circular structures and bin files

    Date: 22 Dec 87 14:08:50 EST
    From: Timothy Daly <DALY@ibm.com>

    Symbolics cannot handle the following in a compile-file.

    (defun foo () '#1=(#1#))

    This will fail complaining that bin files cannot handle
    circular objects. We create circular objects all over the
    place in our data structures and need to write them out.
    Symbolics customer service recommends that we un-circularize
    the objects first. Ha.

    Does anyone have a fix for this behavior?

I'm not claiming any of these "fixes" are pretty, and certainly none are
ideal, or even convenient:


(defvar *foo* (read-from-string "#1=(#1#)")) ;; or (defvar *foo* (eval (read-from-string "'#1=(#1#)")))

(defun foo () *foo*)


(defvar *foo* (scl::circular-list)) ;; or whatever form is necessary to
				    ;; make your circular data structure. 

(defun foo () *foo*)

;; (but I assume that suggestion (b) is what customer-service
;; recommended, which you find unacceptable.)


Or define your own set of 2 dispatching macros. #n@, and #n! (for example).  The
    behavior of #n@ could be identical to #n#, #n! to #n=, with the
    exception that they aren't resolved until load-time.  The macro has
    to insert the function-call to fix them up inside of a #, .
In other words, "just" automatically do what you must manually do in
  alternative (b).

Alternative (c) is probably the most attractive, unless there is some
    reason that the circular structures cannot be "circularized" at load
Alternative (a) is, in some sense, the "easiest", although the ugliest.
Alternative (b) is also easy, but it might be cumbersome, depending on
    the volume, and complexity, of your #n#/#n= constructs.

I guess alternative (d) is to hack the bin-dumper/loader :-)

    Tim Daly
    IBM T.J.Watson Research
    Yorktown Heights, N.Y.