in Project Settings in the Version Information tab in line File Flags the first flag is named Debug. How to query the flag in a program? I would like to use it in the way:
Yes Thomas, I am used to define a constant debug in main.cl to toggle my self-made debug configuration on/off. The program sections, I am conditionally switching on/off in compilation via the constant, contain predicates, which output the contents of structures (for example collections) through stdIo::write for inspection.
When my program is not working as I expect, I set debug to true and place calls to these predicates at suspect points in my code. Once I have found and corrected the bug, I set debug back to false. The compiler then directs me to every place in the code, where I had inserted an inspection call. So I can remove them quickly.
Usually I start that workflow, when I am not able to locate the cause of a problem by just stepping through the code with the debugger. As yet that's my "best practice", and I have no idea how to do better to omit introducing a secondary configuration.
back in the "old" days before the built in debugger, I used to do something very similar.
I would create a global constant, then with conditional compilation flags, I would embed troubleshooting statements in my code surrounded by the flag. Then all I had to do was change the global flag's value and all the 'troubleshooting' code with stay out of the final build.
I still do something similar. It is very handy sometimes, especially when troubleshooting logic/sequence problems.
I have something similar, but at run time.
I use a /log flag and when that is on, things like logging will become active.
More run time code but independent of the IDE.
]an