From: Timothy J H. <tjh...@br...> - 2005-03-17 13:14:51
|
Hi Robert, On Mar 10, 2005, at 12:58 PM, Robert MacIntyre wrote: ---snip--- > I'm after a slightly different target. I have lots of ways to adjust > the output of a program I write, but I want to fix the top-level > interactive interpreter itself. Coming from a background of using > Allegro CL, I want the scheme interpreter to be more convenient for > interactive development. In Allegro, if I type something that returns > a 10000-element list, it (by default) prints the first 10 elements > plus ellipsis, rather than crashing emacs. And if an error occurs, I > get a short message and some options, rather than a stack dump. I > realize jscheme can't do all this right away, but it can do better. > > The tricky part is fixing it without breaking other things, since it > looks like the read-eval-print loop is used for lots of things other > than direct user interaction. True ... > I can think of a few approaches: (1) > break the non-interactive case (bad, but all I have so far), (2) write > my own REPL in scheme and invoke it at startup, (3) write a similar > function in java, or (4) add conditionals to the main one to somehow > distiguish between interactive and non-interactive use. I prefer #4 > for the sake of other future jscheme users, but it's probably the > hardest to get right. Perhaps it would be safer to start with some > variation of #3? I think 4 is a reasonable approach. The easiest thing to do as a first step is to create a public static int variable to that gives the global print depth (zero for infinite depth? zero by default?) The REPL could set it to a reasonable value for interactive sessions. We could specify an interactive session on the command line: % java -cp jscheme.jar jscheme.REPL -interactive One could also change the depth at runtime: > (set! jsint.Scheme.printDepth$ 10) We could also add a global variable for controlling the type of debugging output generated displayed when an exception is thrown ... How does that sound??? ---Tim--- |