Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/clos/describe.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,12 @@
;;; function
(defmethod describe ((obj function) &optional (stream *standard-output*))
(let ((name (oget obj "fname"))
(lambda-list (oget obj "lambdalist"))
(doc (oget obj "docstring")))
(with-pp-buffer (buf)
(pp/presentation obj 'function stream)
(format buf "Name:~a~%" (if name name "anonimous"))
(format buf "Lambda list:~a~%" lambda-list)
(when doc
(format buf "Documentation: ~a~%" doc))
(flush-pp-buffer buf stream))
Expand Down
17 changes: 8 additions & 9 deletions src/compiler/compiler.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,13 @@
(ll-optional-arguments-canonical lambda-list))))
(remove nil (mapcar #'third args))))

(defun lambda-name/docstring-wrapper (name docstring code)
(if (or name docstring)
`(selfcall
(var (func ,code))
,(when name `(= (get func "fname") ,name))
,(when docstring `(= (get func "docstring") ,docstring))
(return func))
code))
(defun lambda-name/docstring-wrapper (name docstring lambda-list code)
`(selfcall
(var (func ,code))
,(when name `(= (get func "fname") ,name))
,(when docstring `(= (get func "docstring") ,docstring))
(= (get func "lambdalist") ,(prin1-to-string lambda-list))
(return func)))

(defun lambda-check-argument-count
(n-required-arguments n-optional-arguments rest-p)
Expand Down Expand Up @@ -464,7 +463,7 @@
keyword-arguments
(ll-svars ll)))))

(lambda-name/docstring-wrapper name documentation
(lambda-name/docstring-wrapper name documentation ll
`(named-function ,(jsize-symbol name 'jscl_user_)
(|values| ,@(mapcar (lambda (x)
(translate-variable x))
Expand Down
5 changes: 5 additions & 0 deletions src/documentation.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
(error "The type of documentation `~S' is not a symbol." type))
(oget x "vardoc"))))

(defun function-lambda-list (function)
"Return the lambda-list of FUNCTION."
(let ((lambda-list (oget (fdefinition function) "lambdalist")))
(when lambda-list
(read-from-string lambda-list))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the comments, this feels a bit weird.
We could just dump the lambda-list with literal from the compiler I guess so there is no need to re-read it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I dumped it as a string. I'm not expert on the compiler internals.


;;; APROPOS and friends

Expand Down