<< Back to previous view

[CONTRIB-35] clojure.contrib.trace/deftrace does not work with function definitions with doc-strings Created: 09/Oct/09  Updated: 26/Jul/13

Status: In Progress
Project: Clojure-Contrib
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect
Reporter: Anonymous Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


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

Sample code to reproduce the error - 

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

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

Comment by Assembla Importer [ 28/Oct/10 5:08 AM ]

Converted from http://www.assembla.com/spaces/clojure/tickets/35
0001-Allow-deftrace-to-work-with-docstrings-and-metadata-.patch - https://www.assembla.com/spaces/clojure/documents/bns8Fu4Jqr37_9eJe5cbCb/download/bns8Fu4Jqr37_9eJe5cbCb

Comment by Assembla Importer [ 28/Oct/10 5:08 AM ]

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)

Comment by Assembla Importer [ 28/Oct/10 5:08 AM ]

trptcolin said: [file:bns8Fu4Jqr37_9eJe5cbCb]

Comment by Assembla Importer [ 28/Oct/10 5:08 AM ]

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.

Comment by Luc Préfontaine [ 30/Sep/11 1:36 PM ]

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.

Generated at Sun Jan 21 01:16:18 CST 2018 using JIRA 4.4#649-r158309.