I just noticed a very useful thing for debugging Bigloo: tracing macros! The way this works is you put (with-tracing n 'foo ...) declarations around your code and if the debug level (set by -g[2..4]) when compiling is greater than n you get a trace which outputs the symbol 'foo indented according to how many previous traces are active. You can also issue (trace-item . items) commands which display the items given at the appropriate level (though this only seems to work when the debug level is greater than 2). Want the debugging info to go away? Just lower the debug level (or---even easier---increase n) when you compile that module. It doesn't sound like much, but the indentation and (trace-item ...) are leaps and bounds better than the (print ...) statements I was constantly un-commenting and commenting out. I now have (with-tracing ...) scattered through my code---it's great.
- If an error occurs within the dynamic extent of the (with-tracing ...) form, the indentation doesn't always reset, so sometimes after several errors your traces are walking off the edge of the screen. (I don't know why a simple dynamic-wind doesn't cut it here:
(dynamic-wind (lambda () (increase-trace-indentation!)) (lambda () 'do something) (lambda () (decrease-trace-indentation!)))but it sometimes doesn't work.)
- Sometimes the prefix of the trace data contains shell formatting characters that kind of mess up the output:
[0m[1;31m |[0m[0m[1;32m |[0m[0m[1;33m |[0m | | | |--+make-advancer-lambda [0m[1;31m |[0m[0m[1;32m |[0m[0m[1;33m |[0m | | | | |--+ calculate-new-dtSometimes calling (trace-margin-set! "") clears this stuff, but sometimes it doesn't.
Anyways, even with the warts it's a pretty useful feature. Enjoy.
Update: In fact, you can get rid of all the cruft at the beginning of these lines by setting the parameter bigloo-trace-color to #f: (bigloo-trace-color-set! #f). Then everything works great within emacs.