Re: Debug Block?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jeremy Cowgar wrote:
> 
> 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.
> 
> <a
> href="http://sourceforge.net/tracker/index.php?func=detail&aid=1771686&group_id=182827&atid=902785">http://sourceforge.net/tracker/index.php?func=detail&aid=1771686&group_id=182827&atid=902785</a>
> 
> He is basically suggesting the ability to remove debug code in the final
> copies
> of your Euphoria source. His suggestion is instead of:
> 
> }}}
<eucode>
> --- code
> if DEBUG then
>     printf(1, "Loop var is %d\n", {loopVar})
> end if
> --- code
> </eucode>
{{{

> 
> 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:
> 
> }}}
<eucode>
> with debug
> 
> --- code
> . printf(1, "Loop var is %d\n", {loopVar})
> --- code
> </eucode>
{{{

> 
> 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:
> 
> }}}
<eucode>
> with debug
> 
> debug
>     printf(1, "Loop var is %d\n", {loopVar})
>     -- more debug code
> end debug
> </eucode>
{{{

> 
> 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
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>

I would like to point out that this is actually a specialized form of
conditional compilation.
A general conditional compilation system would provide this behavior and a lot
more.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu