Re: 0.14-030715 - defgeneric is not preserving doc-strings

Ram Krishnan <[email protected]> Fri, 1 Aug 2003 08:03:16 -0700
Newsgroups gmane.lisp.openmcl.bugs
Message-ID <[email protected]>
I should've tried rebuilding the Lisp image before sending out the last 
patch ... live and learn. Anyway, turns out while the (setf 
(documentation ...)) works in a bootstrapped image, it causes problems 
when building a fresh image. So, here's another version of the patch:

Index: level-1/l1-clos-boot.lisp
===================================================================
RCS file: /usr/local/publiccvs/ccl/level-1/Attic/l1-clos-boot.lisp,v
retrieving revision 1.1.2.17
diff -u -r1.1.2.17 l1-clos-boot.lisp
--- level-1/l1-clos-boot.lisp	25 Jun 2003 04:24:49 -0000	1.1.2.17
+++ level-1/l1-clos-boot.lisp	1 Aug 2003 15:00:19 -0000
@@ -3099,12 +3099,17 @@
          (remove-method gf method))))
    (record-source-file function-name 'function)
    (record-arglist function-name lambda-list)
-  (apply #'ensure-generic-function
-         function-name
-         :lambda-list lambda-list
-         :method-combination method-combination
-         :generic-function-class generic-function-class
-         options))
+  (let ((gf (apply #'ensure-generic-function
+		   function-name
+		   :lambda-list lambda-list
+		   :method-combination method-combination
+		   :generic-function-class generic-function-class
+		   options)))
+    (set-documentation gf t
+		       (destructuring-bind (&rest args &key documentation)
+			   options
+			 (declare (ignore args))
+			 documentation))))

This uses (set-documentation ...) which doesn't have any bootstrapping 
issues.

Regards,

-ram

On Friday, August 1, 2003, at 07:37 AM, Ram Krishnan wrote:

> Any doc-string passed into the (:documentation ..) option of a 
> defgeneric form is not being preserved as the 'function documentation 
> of the generic function symbol.
>
> I have only confirmed this with 0.14-030715 (and in the CVS head).
>
> In order to get around this, I've added the following patch to 
> ccl:level-1;l1-clos-boot.lisp which seems to fix the problem.
>
> Index: level-1/l1-clos-boot.lisp
> ===================================================================
> RCS file: /usr/local/publiccvs/ccl/level-1/Attic/l1-clos-boot.lisp,v
> retrieving revision 1.1.2.17
> diff -u -r1.1.2.17 l1-clos-boot.lisp
> --- level-1/l1-clos-boot.lisp	25 Jun 2003 04:24:49 -0000	1.1.2.17
> +++ level-1/l1-clos-boot.lisp	1 Aug 2003 14:34:55 -0000
> @@ -3099,12 +3099,18 @@
>          (remove-method gf method))))
>    (record-source-file function-name 'function)
>    (record-arglist function-name lambda-list)
> -  (apply #'ensure-generic-function
> -         function-name
> -         :lambda-list lambda-list
> -         :method-combination method-combination
> -         :generic-function-class generic-function-class
> -         options))
> +  (prog1
> +        (apply #'ensure-generic-function
> +               function-name
> +               :lambda-list lambda-list
> +               :method-combination method-combination
> +               :generic-function-class generic-function-class
> +               options)
> +      (setf (documentation function-name 'function)
> +            (destructuring-bind (&rest args &key documentation)
> +                options
> +              (declare (ignore args))
> +              documentation))))
>
> Although, I suspect this is probably not the right place for this to 
> be done.
>
> Regards,
>
> -ram
>
>
> _______________________________________________
> bug-openmcl mailing list
> [email protected]
> http://clozure.com/cgi-bin/mailman/listinfo/bug-openmcl