Clojure

GC Issue 30: Add doc string to ns macro

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Reported by richhickey, Jan 04, 2009
Support
(ns
  "doc string goes here"
 ...)

Comment 1 by m...@kotka.de, Jan 04, 2009
Allow optional docstrings for a namespace as:

(ns foo.bar
  "docstring here"
  ...)

Attached patch uses the namespace symbol to transport the docstring to the namespace.

The Namespace class is modified to call its superclass constructor with the metadata
of the symbol passed in as name. If the first item of the references part of the ns macro
is a string, it is attached to the metadata of the given Symbol. From there it is again
transferred to the meta data of the Namespace.

Modified doc to check for the given symbol being a Namespace. If so its docstring is
retrieved and printed. If the symbol does not name a Namespace, it is interpreted as
a Var.

Added helper print-namespace-doc to complement print-doc.


 issue-30.diff
2.2 KB Download
Comment 2 by richhickey, Jan 22, 2009
Patch applied - svn 1224 - thanks!
Status: Fixed

People

  • Assignee:
    Unassigned
    Reporter:
    Anonymous
Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: