Clojure JIRAhttp://dev.clojure.org/jira
This file is an XML representation of an issueen-us4.464925-07-2011[CLJ-695] pprint does not respect *print-length*http://dev.clojure.org/jira/browse/CLJ-695
Clojure<p>pprint does not respect <tt><b>print-length</b></tt> &#8211; instead it prints ellipses for every element one length is passed (and prints forever on infinite collections).</p>CLJ-695pprint does not respect *print-length*DefectMajorClosedCompletedUnassignedStuart HallowaySat, 18 Dec 2010 15:11:14 -0600Fri, 1 Mar 2013 12:47:10 -0600Fri, 31 Dec 2010 15:53:23 -0600Release 1.300<p>The attached patch is part of a possible fix. Issues to run down:</p>
<ul>
<li>where and how is the return value of <tt>write-out</tt> used. (The changes I make eliminate this dependency in favor of a direct check of the dynamic variables.</li>
<li>how to make sets work? they are in a different code path than the others</li>
</ul>
<p>Hmm, looks like I broke some logic when I hand unrolled the original cl-format based dispatch to get better performance for lists, vectors, and maps. (Really I shouldn't have to do this, but I need to make cl-format itself generate code rather than threaded functions which are slow and tend to blow your stack. Haven't gotten around to that yet, though so the hand-coded versions are stop-gaps.)</p>
<p>I'm not digging the patch too much, though, for 3 reasons:</p>
<p>1) It breaks sets and arrays, which work in master.<br/>
2) It pushes the logic for <b>print-length</b> printing into the dispatch functions (redundantly since there's still logic in write-out). Since these are customizable, it places that load on whoever customizes it.<br/>
3) It adds redundant logic in write-out which is the called for every object that the pretty printer deals with.</p>
<p>I'll try to take a stab at a patch that fits a little better with what I'm trying to do in the next couple of days.</p><p>This fixes the the issue with hand-rolled dispatch functions and provides a macro to help other users do it correctly as well.</p><p>Second patch is good. This is more important because apparently the IDE REPLs use pprint by default.</p>ApprovalOkGlobal RankPatchCode and Test