<< Back to previous view

[TTRACE-9] Use aprint when displaying value Created: 29/Oct/14  Updated: 30/Oct/14

Status: Open
Project: tools.trace
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Jérémie Grodziski Assignee: Luc Préfontaine
Resolution: Unresolved Votes: 0
Labels: enhancement, print

Attachments: File use-aprint.diff    
Patch: Code and Test


Problem: when trace-ns is used, very long displays in the output stream is very hard to read when the fn calls are important and with voluminous data structure
Solution: Use Aprint library when printing value in the output string, now get syntax hightlighting and better layout of data structure
Tradeoffs: add a new dependency to tools.trace
Tests: yes, modify the cleanup fn to also clean the color information added by aprint, so 100% tests passed

Comment by Andy Fingerhut [ 30/Oct/14 7:36 AM ]

Jeremie, I am not certain, but I believe it is a policy of Clojure contrib libraries not to depend on libraries other than those in Clojure or Clojure contrib.

Perhaps if new arities were added to some existing tools.trace functions or macros, sprint or any other developer-desired function could be provided as arguments to control how printing occurs?

Comment by Jérémie Grodziski [ 30/Oct/14 8:17 AM ]

Hi Andy,

Thanks for your comment, yes I thought about that and known it would be the greatest concern...
I'll have a look at 2 possibilities:

  • the fastest: add new arg to tools.trace fns and macros for providing a filter that can add the colors and layout
  • the better: see if inlining the aprint code is worth considering, or better add the syntax hightlighting feature in clojure.pprint even though pprint is not used in tools.trace (and along with some neat library like Pretty that could be added to clojure.repl)

In the end, adding aprint (both for color and layout) made a HUGE difference for me in usability...

Comment by Alex Miller [ 30/Oct/14 10:18 AM ]

Andy, that is not a policy afaik, merely a preference to minimize them as much as possible. There are other contribs that have external dependencies. It's up to Luc as the contrib lead whether he thinks this is ok here.

Comment by Luc Préfontaine [ 30/Oct/14 10:59 AM ]

I've looked into this. 'Inlining aprint' in tools.trace would be my first choice.
However we need to get Vlad Bokov to fill a CA (I do not see him in the list of contributors)
and to grant us the rights to include part of is source code in tools.trace.

Being a regular user of this tool, I find the arity avenue painful. It happens that we use this in
integrated test mode to nail issues. Then the output goes to a file were tty ansi commands
are not welcomed.

I think we need a mode state to enable/disable this feature. In the repl you would need a single
statement to get the colored output whatever trace fns you are calling. That can be part of your
user profile.

Eventually this could migrate to core.pprint but that will require some time before it ends up in a clojure release.

Meanwhile we can keep this isolated in tools.trace so it can be moved later elsewhere.

Comments ?

Comment by Luc Préfontaine [ 30/Oct/14 12:50 PM ]

I sent an email to Vlad and the url to this ticket.
Will have a discussion off line first and then move along with the plan if we can.

Generated at Thu Oct 30 14:20:57 CDT 2014 using JIRA 4.4#649-r158309.