Completed
Details
Assignee
UnassignedUnassignedReporter
Alan MalloyAlan MalloyApproval
OkPatch
CodePriority
MinorAffects versions
Fix versions
Details
Details
Assignee
Unassigned
UnassignedReporter
Alan Malloy
Alan MalloyApproval
Ok
Patch
Code
Priority
Affects versions
Fix versions
Created January 10, 2012 at 11:15 PM
Updated May 24, 2013 at 1:55 PM
Resolved May 24, 2013 at 1:55 PM
1.3 removed the metadata slot on most functions, and made
.withMeta
return a new wrapping function that provides metadata. This changes the way functions with metadata print: instead of#<user$eval595$fn_
596 user$eval595$fn_596@3d48ff04>
we now see#< clojure.lang.AFunction$1@581de498>
. I might argue that we should "lie" and print the class of the original wrapped function since it's more useful than AFunction$1, but that's debatable. The two things I propose changing are:When print-meta is true, we should print the metadata map for functions. That nothing prints implies there is no metadata, which can make it difficult to track down bugs related to metadata on functions.
Remove the errant space at the front of the printed representation of functions with meta, changing
#< clojure.lang.AFunction$1@581de498>
to#<clojure.lang.AFunction$1@581de498>
. The cause of this issue is that.getSimpleName
on an object with an anonymous class returns""
, and we print that followed by a space and its.toString
. My fix is to omit the extra space if the class has no simple name; this would cause instances of other anonymous (non-function) classes to print more nicely as well.If it would be desirable to print the class of the original "wrapped" function, then I can easily add another patch for that.