Hi!
I found that:
CL-USER> (let ((foo (lambda () "With docstring" 100500)))
(princ (funcall foo)) (terpri) (princ (documentation foo t)))
100500 NIL NIL
in ECL, but:
CL-USER> (let ((foo (lambda () "With docstring" 100500)))
(princ (funcall foo)) (terpri) (princ (documentation foo t)))
100500 With docstring "With docstring"
Why?
BTW, similar behaviour have ABCL, Allegro and CCL. But SBCL and CLISP work as expected.
Hello,
the problem origins from the fact, that documentation isn't stored in the same structure as the function definition (we have PDE machanism and expand-set-documentation for that). Lambda macro doesn't use them, because it doesn't have associated global symbol (same goes for flet and labels as well as for macrolet and such).
This is a quirk I would want to fix at some point of time. The way to go will be adding documentation slot to the appropriate structures. Another problem originating from the current behavior is that our documentation is usually lost when the image is restarted (unless we dump the documentation and load it again at start) – fas files doesn't contain documentation entries whatsoever.
I'm adding #337 issue to the tracker so you can track a progress when I get to it: https://gitlab.com/embeddable-common-lisp/ecl/issues/337 . I don't know about the other implementations.
Best regards, Daniel
Alexander Artemenko writes:
Hi!
I found that:
CL-USER> (let ((foo (lambda () "With docstring" 100500)))
(princ (funcall foo)) (terpri) (princ (documentation foo t)))
100500 NIL NIL
in ECL, but:
CL-USER> (let ((foo (lambda () "With docstring" 100500)))
(princ (funcall foo)) (terpri) (princ (documentation foo t)))
100500 With docstring "With docstring"
Why?
BTW, similar behaviour have ABCL, Allegro and CCL. But SBCL and CLISP work as expected.