Why shouldn’t we use boolean arguments?
Show answer and explanation
A boolean argument hides meaning at the call site and often signals two behaviors packed into one function. Prefer a named enum, options type, or separate named functions when the choice represents a domain mode rather than a simple predicate.
A boolean argument hides meaning at the call site and often signals two behaviors packed into one function. Prefer a named enum, options type, or separate named functions when the choice represents a domain mode rather than a simple predicate.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.