`(:internal-reader-function
,(structure-slotd-reader-function slotd)
:internal-writer-function
- ,(structure-slotd-writer-function slotd)))
+ ,(structure-slotd-writer-function name slotd)))
:type ,(or (structure-slotd-type slotd) t)
:initform ,(structure-slotd-init-form slotd)
:initfunction ,(eval-form (structure-slotd-init-form slotd)))))
(defun structure-slotd-reader-function (slotd)
(fdefinition (dsd-accessor-name slotd)))
-(defun structure-slotd-writer-function (slotd)
- (unless (dsd-read-only slotd)
- (fdefinition `(setf ,(dsd-accessor-name slotd)))))
+(defun structure-slotd-writer-function (type slotd)
+ (if (dsd-read-only slotd)
+ (let ((dd (get-structure-dd type)))
+ (coerce (sb-kernel::slot-setter-lambda-form dd slotd) 'function))
+ (fdefinition `(setf ,(dsd-accessor-name slotd)))))
(defun structure-slotd-type (slotd)
(dsd-type slotd))
(defparameter *numbers*
'(-1s0 -1f0 -1d0 -1l0
#c(-1s0 -1s0) #c(-1f0 -1f0) #c(-1d0 -1d0) #c(-1l0 -1l0)))
-
+\f
+;;; tests for MAKE-LOAD-FORM-SAVING-SLOTS
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (defstruct savable-structure
+ (a nil :type symbol)
+ (b nil :type symbol :read-only t)
+ (c nil :read-only t)
+ (d 0 :type fixnum)
+ (e 17 :type (unsigned-byte 32) :read-only t))
+ (defmethod make-load-form ((s savable-structure) &optional env)
+ (make-load-form-saving-slots s :environment env)))
+(defparameter *savable-structure*
+ #.(make-savable-structure :a t :b 'frob :c 1 :d 39 :e 19))
+(assert (eql (savable-structure-a *savable-structure*) t))
+(assert (eql (savable-structure-b *savable-structure*) 'frob))
+(assert (eql (savable-structure-c *savable-structure*) 1))
+(assert (eql (savable-structure-d *savable-structure*) 39))
+(assert (eql (savable-structure-e *savable-structure*) 19))
+\f
(sb-ext:quit :unix-status 104) ; success
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8alpha.0.39"
+"0.8alpha.0.40"