Clojure-Contrib

clojure.contrib.trace/deftrace does not work with function definitions with doc-strings

Details

  • Type: Defect Defect
  • Status: In Progress In Progress
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Apparently, defttrace does not support functions with doc-strings. I tried replacing defn with deftrace in a function of mine (as the docs indicated) and I got the following error -

java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol
</code></pre>

Sample code to reproduce the error - 

<pre><code>(deftrace fact
  "Calculate the factorial of x"
  [x]
  (if (< x 1)
    1
    (* x (fact (- x 1)))))

Would be great if this bug is fixed, all my functions have doc-strings

Activity

Hide
Luc Préfontaine added a comment -

Issue fixed in tools.trace 1.0 which is compatible for both Clojure 1.2.x and 1.3.
The macro now verifies if the first argument is a doc string and adapts accordingly.
This ticket can be closed.

Show
Luc Préfontaine added a comment - Issue fixed in tools.trace 1.0 which is compatible for both Clojure 1.2.x and 1.3. The macro now verifies if the first argument is a doc string and adapts accordingly. This ticket can be closed.
Hide
Assembla Importer added a comment -

trptcolin said: This patch adds support and tests for both docstrings and metadata, and also fixes the regex in the existing test to correctly identify errors. The current regex has unescaped characters: | ( ) that were almost certainly typos, as matching (for instance) only the last line of output would pass the test. The docstring/metadata support is a simplified version of what's in the source of defn.

Show
Assembla Importer added a comment - trptcolin said: This patch adds support and tests for both docstrings and metadata, and also fixes the regex in the existing test to correctly identify errors. The current regex has unescaped characters: | ( ) that were almost certainly typos, as matching (for instance) only the last line of output would pass the test. The docstring/metadata support is a simplified version of what's in the source of defn.
Hide
Assembla Importer added a comment -

trptcolin said: [file:bns8Fu4Jqr37_9eJe5cbCb]

Show
Assembla Importer added a comment - trptcolin said: [file:bns8Fu4Jqr37_9eJe5cbCb]
Hide
Assembla Importer added a comment -

stuart.sierra said: Updating tickets (#1, #2, #3, #4, #6, #20, #23, #25, #30, #31, #33, #34, #35, #37, #38, #52, #55, #58, #59, #60, #61, #62, #63, #64)

Show
Assembla Importer added a comment - stuart.sierra said: Updating tickets (#1, #2, #3, #4, #6, #20, #23, #25, #30, #31, #33, #34, #35, #37, #38, #52, #55, #58, #59, #60, #61, #62, #63, #64)
Hide
Assembla Importer added a comment -
Show
Assembla Importer added a comment - Converted from http://www.assembla.com/spaces/clojure/tickets/35 Attachments: 0001-Allow-deftrace-to-work-with-docstrings-and-metadata-.patch - https://www.assembla.com/spaces/clojure/documents/bns8Fu4Jqr37_9eJe5cbCb/download/bns8Fu4Jqr37_9eJe5cbCb

People

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

Dates

  • Created:
    Updated: