Bill Newman <·······@netcom.com> wrote:
>
> ... compile a file containing
>
> (eval-when (:compile-toplevel :load-toplevel)
> (defstruct foo x y z))
> (defconstant +foo+ #S(FOO :X 12))
>
> and see what happens. For example, CMUCL says
>
> Structures of type FOO cannot be dumped as constants.
>
> ACL's error message pointed me to MAKE-LOAD-FORM, and I think
> I understand how to use it now, but it seems like a lot of work
> just to dump a humble struct.
It's a problem of these two Lisp implementations (and a deficiency of the
ANSI CL standard). CLISP compiles and loads this file without problems.
(in-package "CL-USER")
(defstruct foo x y z)
(defconstant +foo+ #S(FOO :X 12))
The MAKE-LOAD-FORM facility aims at saving lots of structure and instance
objects altogether, even if they form a graph with cycles. A decent
compiler can achieve this through the use of *PRINT-CIRCLE* as well, though.
Bruno