Zulip Chat Archive

Stream: lean4

Topic: zero overhead debug tracing in pure code?


Siddharth Bhat (May 19 2023 at 06:59):

What's the lean equivalent of

#ifdef VERBOSE
printf("debug logging here");
#endif

In particular, I am looking for a way to insert debug logging into my pure code, such that when the project is built in release mode, the debug print has zero overhead. It would be even cooler if in debug mode, the printing can be toggled by a trace class.

Mario Carneiro (May 19 2023 at 07:49):

Does lean even have a debug mode?

Mario Carneiro (May 19 2023 at 07:50):

You should be able to hack something together using a term elaborator that is a no-op if some set_option is set


Last updated: Dec 20 2023 at 11:08 UTC