[Openmcl-devel] Patch for slot documentation inflecity

Gary King gwking at metabang.com
Wed Feb 1 07:01:30 PST 2006


According to people who know the MOP much better than I do!, the  
following should work:

> (in-package ccl)
>
> (defclass test ()
>   ((a-slot :documentation "This is a test.")))
>
> (finalize-inheritance (find-class 'test))
>
> (assert (string= (documentation (find 'a-slot (class-slots (find- 
> class 'test))
>                                       :key #'slot-definition-name)
>                                 t)
>                  "This is a test."))

but it fails in OpenMCL (version 1.0).

Either of these patches corrects this behavior in OpenMCL:

>> (defmethod documentation ((slot slot-definition) (doc-type (eql 't)))
>>   (slot-value slot 'documentation))
>>
>> (defmethod (setf documentation) ((new t)
>> 				 (slot slot-definition)
>> 				 (doc-type (eql 't)))
>>   (setf (slot-value slot 'documentation) new))

or

>> (defmethod initialize-instance :after ((slot slot-definition) &key  
>> documentation)
>>   (setf (documentation slot 't) documentation))

I'm not sure which one is more legitimate so I'll let more informed  
minds make the choice!

thanks,
-- 
Gary Warren King
metabang.com
http://www.metabang.com/





More information about the Openmcl-devel mailing list