Lisp HUG Maillist Archive

defstruct and make-load-form?

Hello,

Is the following supposed to work?
I am not sure, but I think that from my reading of the spec it should.
However a-struct does not seem to be compatible with the definition
of make-load-form.

(defstruct a-struct a)

(defconstant a-test
  (list (make-a-struct :A 4)))

(defun a-test-fun (a)
  (member a a-test :test #'eq))


(defmethod make-load-form ((ich a-struct))
  (make-load-form-saving-slots ich))

Rene. (LWW 4.2.7)

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

Re: defstruct and make-load-form?

* Rene de Visser wrote:
> I am not sure, but I think that from my reading of the spec it should.
> However a-struct does not seem to be compatible with the definition
> of make-load-form.

You have the wrong signature for the GF: it should be

(defmethod make-load-form ((ich a-struct) &optional environment)
  (make-load-form-saving-slots ich :environment environment))

though I'm fairly sure the environment arg is not actually used here.

Given this (and some care about making sure things are known to the
compiler) it seems to work fine.

--tim


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

Updated at: 2020-12-10 08:59 UTC