[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.
- Re: Inline `ifdef style` debugging, (continued)
- Re: Inline `ifdef style` debugging, Andreas Schwab, 2011/08/08
- Re: Inline `ifdef style` debugging, Dennis Williamson, 2011/08/08
- Re: Inline `ifdef style` debugging, Roger, 2011/08/08
- Re: Inline `ifdef style` debugging, Steven W. Orr, 2011/08/08
- Re: Inline `ifdef style` debugging, Roger, 2011/08/08
- Who's the target? Was: Inline `ifdef style` debugging, Steven W. Orr, 2011/08/08
- Re: Who's the target? Was: Inline `ifdef style` debugging, Roger, 2011/08/08
- Re: Who's the target? Was: Inline `ifdef style` debugging, Roger, 2011/08/09
- Message not available
- Aw: Re: Inline `ifdef style` debugging, pjodrr, 2011/08/11
- Re: Re: Inline `ifdef style` debugging, Roger, 2011/08/11
- Re: Re: Inline `ifdef style` debugging,
Greg Wooledge <=
- Re: Re: Inline `ifdef style` debugging, Roger, 2011/08/11
- Re: Re: Inline `ifdef style` debugging, Greg Wooledge, 2011/08/11
- Message not available
- Aw: Re: Re: Inline `ifdef style` debugging, pjodrr, 2011/08/11
- Message not available
- Aw: Re: Re: Inline `ifdef style` debugging, pjodrr, 2011/08/11