Debug Block?
- Posted by Jeremy Cowgar <jeremy at co?gar?com> May 11, 2008
- 707 views
I was looking through the feature requests on the SF.net page trying to clean things up. A lot of old suggestions exist, some of which were already implemented, so I closed them. Anyway, I ran across a feature request by CK Lester and figured I would bring his suggestion to the forum for discussion so we can either implement (do not think it would be hard) or clear the suggestion. No reason to have it sit there in limbo for no reason. Keep in mind, I am just brining this to peoples attention. It's not my idea, although, I think it's a good one. http://sourceforge.net/tracker/index.php?func=detail&aid=1771686&group_id=182827&atid=902785 He is basically suggesting the ability to remove debug code in the final copies of your Euphoria source. His suggestion is instead of:
--- code if DEBUG then printf(1, "Loop var is %d\n", {loopVar}) end if --- code
which would be included in your final code, therefore causing extra processing for no reason (has to check DEBUG condition). His idea is that a debug statement be added:
with debug --- code . printf(1, "Loop var is %d\n", {loopVar}) --- code
His suggestion was any line starting with a . would be debug code. Thus, when with debug or without debug is in the source code, the lines starting with . would not even be emitted to the final versions of your Euphoria programmer, thus, debug code would cause no slow down in your final version of your app. I also thought possibly instead of . you could:
with debug debug printf(1, "Loop var is %d\n", {loopVar}) -- more debug code end debug
Over all I do not see any bad side effects, only benefits, but wanted to get your input. I do think a more defined block, such as debug ... end debug would make the source code a bit cleaner and more easily understood, but everyone can go read CK's feature request on the SF URL listed above. -- Jeremy Cowgar http://jeremy.cowgar.com