Subject: Re: error: don't know how to dump ..., &key vs &optional
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 10 Aug 2007 02:18:15 -0500
Newsgroups: comp.lang.lisp
Message-ID: <hKydnWMteKyqjCHbnZ2dnUVZ_hKdnZ2d@speakeasy.net>
Larry Clapp <larry@theclapp.org> wrote:
+---------------
| Rob Warnock <rpw3@rpw3.org> wrote:
| > Note that depending on the implementation this might require having
| > *PRINT-CIRCLE* set to T for the MAKE-LOAD-FORM to work, e.g.:
| ...
| >     cmu> (make-load-form *x*)
| >     (ALLOCATE-INSTANCE (FIND-CLASS 'FOO))
| >     (PROGN
| >       (SETF (SLOT-VALUE #S(FOO :A 12 :B BAZ :C "string") 'A) '12)
| >       (SETF (SLOT-VALUE #S(FOO :A 12 :B BAZ :C "string") 'B) 'BAZ)
| >       (SETF (SLOT-VALUE #S(FOO :A 12 :B BAZ :C "string") 'C) '"string"))
| >     cmu> 
| >
| > Now that's probably *not* going to "do what you want"!!  ;-}
| > But this may:
| >     cmu> (setf *print-circle* t)
| >     T
| >     cmu> (make-load-form *x*)
| >     (ALLOCATE-INSTANCE (FIND-CLASS 'FOO))
| >     (PROGN
| >       (SETF (SLOT-VALUE #1=#S(FOO :A 12 :B BAZ :C #2="string") 'A) '12)
| >       (SETF (SLOT-VALUE #1# 'B) 'BAZ)
| >       (SETF (SLOT-VALUE #1# 'C) '#2#))
| >     cmu> 
| 
| I am not familiar with the semantics of MAKE-LOAD-FORM.  Are you
| telling me it works by way of READ-FROM-STRING?  Otherwise, I don't
| understand your example.
+---------------

No, I was mistaken [as I was kindly advised off-list].

See, I was just noodling around in the REPL and observed that:

(1) MAKE-LOAD-FORM's results were not printed in a useful form
    [required object identities were lost]; and

(2) printing with *PRINT-CIRCLE* set to T made it *appear*
    to be more useful; but

(3) later I realized that the above PROGN form doesn't return a
    useful value, and what you really need for the second return
    value of MAKE-LOAD-FORM to be usable across a WRITE/READ cycle
    is for it to look like this:

    cmu> (PROGN
           (SETF (SLOT-VALUE #1=#S(FOO :A 12 :B BAZ :C #2="string") 'A) '12)
           (SETF (SLOT-VALUE #1# 'B) 'BAZ)
           (SETF (SLOT-VALUE #1# 'C) '#2#)
           #1#)

    #S(FOO :A 12 :B BAZ :C "string")
    cmu> 

    But since CMUCL's MAKE-LOAD-FORM *doesn't* return the latter,
    my whole assumption was/is flawed.

So, sorry for the confusion. "Never mind..."


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607