Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree with you there, so I guess what I want is a REPL that has hooks for custom printers, i.e to display an object of type X my way instead of the usual way. I'd like "printing" to optionally include graphics or whatever else makes for a good display of that data. And I'd like the representation to be interactive, so that one can drill down into sub-data or whatever else is appropriate. That too (obviously) is the responsibility of the custom printer, not the REPL itself, but I wish the REPL would make it easy to build such extensions. Little domain-specific visualizers.

Why? Well, some programs rely heavily on specific data structures that may not be very easy to interact with if you print them out as generic lists or hashtables or whatever. The Slime Inspector is next to useless for things of any complexity.



I present to you print-object, a generic function in Common Lisp.

http://clhs.lisp.se/Body/f_pr_obj.htm

So say you have a object type FOO, you can do this:

    (defmethod print-object ((obj FOO) stream)
      ...)
Now, when you have a FOO on the repl, print-object will be called.

Obviously it doesn't provide a drilldown approach and any number of nifty and useful functions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: