wanted: different docs for same function under different names

Bug #661631 reported by Nikodemus Siivola
30
This bug affects 3 people
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Medium
Unassigned

Bug Description

Consider:

 (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 1.0.29.24 when we added proper documentation for anonymous functions.

Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
status: Triaged → In Progress
description: updated
Revision history for this message
Stas Boukarev (stassats) wrote :
Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

In 1.0.43.63.

Changed in sbcl:
assignee: Nikodemus Siivola (nikodemus) → nobody
status: In Progress → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
Revision history for this message
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
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
Stas Boukarev (stassats) wrote :

That was fixed some time ago.

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.