Dan Sugalski wrote:

I'm considering adding in some new ops and a command-line switch to help debug parrot code, but before I did I figured I'd better throw it out to the list for some debugging. (This seems like something which could be of good general use, and as such I'd like to hash it out, do it once, and do it right)

As I've been writing library code in pir, I'm finding I've got a *lot* of commented-out printerr sections, as well as a fair amount of intermediate code to generate the data to be printed. What would be useful would be a relatively fast and simple way to leave these in and just skip over them, or have them not execute. As such I'm thinking we could use:

 dprinterr [PISN]x - Like printerr, but only when running in debug mode
 ifdebug label - If debug's on, branch to label
 unlessdebug label - branch to label unless debugging's on
 debugbsr label - do a bsr to the label if debugging's on

As well as making the current debug status part of the interpreter info section which can be queried and branched on as needed. I can certainly see skipping the if/unlessdebug stuff, though the print only if debugging would make the code a lot cleaner, such as it is. (I'm also thinking that a conditional bsr would be useful, but I'm not sure it'd be useful *enough*) If it'd make the JIT unhappy to have more branching ops they can be left out.


Maybe a bit off-topic (as it concerns pir syntax), but wouldn't it be usefull if we had multi-line comments?
I find myself commenting out line after line quite some time, so if that could
be done by only inserting 2 tokens (start/end comment), that would be great.


Just an idea.

Klaas-Jan



Reply via email to