Hacker News new | ask | show | jobs
by baw-bag 299 days ago
Please if you are in this situation do not take this advice. You just generate massive garbage abstractions upstream. If boolean arguments are out of hand, the problem isn't the boolean.
1 comments

Isn't that the point? If booleans are out of hand, either you are trying to emulate a state machine or you are lacking enums. Or in case of 20 bool parameters, just make it a struct. Nobody will complain.
Everyone's always trying to emulate a state machine - OOP objects are kind of just an unsafe informal state machine implementation.

Oddly, almost noone has tried providing actual state machines where you have to prove you've figured out what the state transitions are.