in reply to Re^4: flip-flop flop
in thread flip-flop flop
The main reason is that implicit state that must be resetted explicitly is a bad idea. Especially if you compare it to a lexical variable, which provides state explicitly, and is resetted implicitly at the end of the scope.
For example if an exception is thrown before you do the reset, the next call of your function will return wrong results.
And what if there are multiple flip-flops in scope? How do you control which one is reset?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: flip-flop flop
by morgon (Priest) on Mar 30, 2012 at 13:41 UTC | |
by moritz (Cardinal) on Mar 30, 2012 at 13:56 UTC | |
by morgon (Priest) on Mar 30, 2012 at 14:18 UTC | |
by moritz (Cardinal) on Mar 30, 2012 at 16:11 UTC |