Most programmers (including me) believe that methods with a boolean flag parameter should be refactored into two methods without the flag parameter. Are there any use cases for a boolean parameter where it isn't a flag? I haven't been able to think of any. However, just because I can't think of an example doesn't mean that one doesn't exist.
I'm after an example where at least 90% of programmers would agree that a boolean parameter makes the most sense, produces the cleanest, most elegant code, etc. That is to say, the use case should be fairly uncontroversial. The method should use the boolean value itself and not simply pass it through to some other method. If you believe there can never be such an example, please explain your rationale.
The boolean shouldn't be retrieved by your library or passed to another (that's an interface design issue).
class BooleansAreNotFlags { function foo() { bool a_non_flag_boolean = result_of_calculation_or_logic(); bar(a_non_flag_boolean); } function bar(bool not_a_flag) { // do something with not_a_flag } What code could go into function bar(bool) {} where refactoring the boolean out of it would make it worse? If you can only think of an example with more than one parameter, that's OK too.