Skip to content

Feature request: PARSE-BODY configurable behaviour when duplicate doc strings occur

It would be nice if it was possible to parse bodies with duplicate doc-strings.

It could be provided as an additional keyword argument that would take options like :error [default one as it is current behaviour], :warn, :ignore, :override [this one to take the latest doc-string instead of the first one]

Another option would be to signal a continuable error instead of just error with restarts like ignore and override.

[ I am pretty sure that "override" is not the right name here, but I don't know how to name that instead ]

To add a bit of context: CLHS 3.4.11 says "The consequences are unspecified if more than one such documentation string is present."

To understand possible behavior I tried the following code on multiple implementations:

(defun abcd () "a" "b" "c" "d")
(documentation 'abcd 'function)

Here are the results: Implementations can

  • Silently use the first string ("a") as the documentation string.

    CMUCL [21e], Allegro CL [FEE 10.1], ECL [21.2.1], ABCL [1.9.1], LispWorks [PE 8.0.1]

  • Warn about the the first duplicate doc string ("b") and uses the first one ("a") as the documentation string.

    SBCL [2.3.9]

  • Silently use the last string ("c") as the documentation string.

    CCL [1.12], CLASP [2.2.0]

  • Signal an uncontinuable error.

    CLISP [2.49.93]

Edited by Alexander Fedorov