Clojure

implementation of doc macro in core.repl incorrect for special names... add one character to fix

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Declined
  • Affects Version/s: Release 1.3
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

In the implementation of the doc macro in core.repl, the line:
(if-let [special-name ('{& fn catch try finally try} name)]
contains:{& fn catch try finally try} which is a hashmap.

It should be a set, and the line should read:
(if-let special-name ('#{& fn catch try finally try} name)

To see the bug at work:
user> (doc &)
-------------------------
clojure.core/fn
(fn name? [params*] exprs*)
(fn name? ([params*] exprs*) +)
Special Form
params => positional-params* , or positional-params* & next-param
positional-param => binding-form
next-param => binding-form
name => symbol

Defines a function

Please see http://clojure.org/special_forms#fn

Activity

Hide
Andy Fingerhut added a comment -

Daniel, I'm pretty sure it is intended to be a map, not a set. The goal is to show the same documentation for try whether you ask for the documentation of try, catch, or finally. Also, to show the documentation for fn if you ask for the documentation of &, since that symbol is only useful in arg lists in fn (or let). They could have put multiple entries in special-doc-map and not had that little map inside doc, but that little map avoided the need for such duplication.

Show
Andy Fingerhut added a comment - Daniel, I'm pretty sure it is intended to be a map, not a set. The goal is to show the same documentation for try whether you ask for the documentation of try, catch, or finally. Also, to show the documentation for fn if you ask for the documentation of &, since that symbol is only useful in arg lists in fn (or let). They could have put multiple entries in special-doc-map and not had that little map inside doc, but that little map avoided the need for such duplication.
Hide
Daniel Eklund added a comment -

100% agree. It was an incorrect report on my part. Thanks for clearing it up.

Show
Daniel Eklund added a comment - 100% agree. It was an incorrect report on my part. Thanks for clearing it up.
Hide
Andy Fingerhut added a comment -

Daniel asked me to change the state of the ticket, since he could not see how to (perhaps insufficient privileges). Not sure if it should be marked Closed or Resolved, so I'm picking Resolved.

Show
Andy Fingerhut added a comment - Daniel asked me to change the state of the ticket, since he could not see how to (perhaps insufficient privileges). Not sure if it should be marked Closed or Resolved, so I'm picking Resolved.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: