bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Inline `ifdef style` debugging


From: Greg Wooledge
Subject: Re: Re: Inline `ifdef style` debugging
Date: Thu, 11 Aug 2011 08:13:27 -0400
User-agent: Mutt/1.4.2.3i

On Thu, Aug 11, 2011 at 12:23:00AM -0700, pjodrr wrote:
> they call it "collapsing functions":
> http://wiki.bash-hackers.org/howto/collapsing_functions

"The first time you run chatter(), the function redefines itself based on the
value of verbose. Thereafter chatter doesn't check $verbose anymore, it simply
is. Further calls to the function reflect its collapsed nature. If verbose is
unset, chatter will echo nothing, with no extra effort from the developer."

The problem with this is that you can't switch to the other function
later.

unset verbose
chatter "$i"
...
verbose=1
chatter "$j"

Here, the first call to chatter blows away the test of $verbose, so
the next time we call it, the fact that we've set verbose=1 is ignored.
We're stuck in non-verbose mode forever.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]