wanted: different docs for same function under different names

Bug #661631 reported by Nikodemus Siivola on 2010-10-16
This bug affects 3 people
Affects Status Importance Assigned to Milestone

Bug Description


 (setf (symbol-function 'foo) #'car)
 (setf (symbol-function 'bar) #'car)

 (setf (documentation 'foo 'function) "Returns the thing.")
 (setf (documentation 'bar 'function) "Names of the thang.")

The (SETF DOCUMENTATION) should not set the documentation slot of the function, but rather store the documentation under the given name.

Regression since when we added proper documentation for anonymous functions.

Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
status: Triaged → In Progress
description: updated
Nikodemus Siivola (nikodemus) wrote :


Changed in sbcl:
assignee: Nikodemus Siivola (nikodemus) → nobody
status: In Progress → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
Stas Boukarev (stassats) wrote :

This only solves the problem with SBCL code, which only uses (setf ([f]documentation 'structure-accessor 'function) "...")

But since structures share the same closure for accessors, setting documentation of #'structure-accessor will mess it up. It's not used this way in the sources of SBCL, but external libraries do that (cxml, for example). So it's sufficient just to load a library with a single (setf documentation) on a structure accessor to mess up all other accessor docstrings throughout SBCL.

Changed in sbcl:
status: Fix Released → Triaged
tags: added: documentation
Stas Boukarev (stassats) wrote :

Note that (setf fdocumentation) is susceptible to this problem when called on symbols. Although it can be easily fixed in the same manner as (setf documentation), I see no point in doing so, since it will be messed up by external libraries anyway.

Nikodemus Siivola (nikodemus) wrote :

You're right, we need to either store docs for closures in a weak hash-table, or add a slot to closure objects.

Stas Boukarev (stassats) wrote :

That was fixed some time ago.

Changed in sbcl:
status: Triaged → Fix Committed
Stas Boukarev (stassats) on 2014-05-30
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers