Re: Some minor patches / E stack traces
Kevin Reid <kpreid-M/[email protected]> Fri, 2 Sep 2011 07:46:05 -0400
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <[email protected]> |
On Sep 2, 2011, at 6:29, Thomas Leonard wrote: > Agree that highlighting should be separated from the exceptions, but > I'm not sure the answerer is the best place - many stack traces come > from traceln(ex). Under normal conditions, traceln goes to a file. Ignoring that fact, I would say the TextWriter responsible for printing the exception object should in this case be responsible for triggering highlighting -- I've been wanting for a while to generalize TextWriter into producing other sorts of output. E-on-CL has a sketch of this - it's possible to plug into TextWriter an object which changes the print syntax (though the output is plain text). (Particularly, TextWriter has the invariant that printing an object does not grant its authority. I have the notion to generalize to the name "Writer" (unfortunately a name conflict with Java, but it makes sense inside of the E world) an object which has the same interface but may release authority. (Then the guard on a __printOn method may be either TextWriter or Writer depending.) One use of such a facility would be a GUI REPL -- permitting the user to select objects within a response and operate on them.) So, the TextWriter(s) responsible for printing the argument to traceln should know that *if* trace output is going to a console, they should provide color output. -- Kevin Reid <http://switchb.org/kpreid/>