4 ms·
> I'm in favor of banning Booleans (and if-statements) I would love to hear your reasoning on this. I think that either I'm misunderstanding you, or one of us
by dotancohen 4y ago
> I'm in favor of banning Booleans (and if-statements)
I would love to hear your reasoning on this. I think that either I'm misunderstanding you, or one of us is crazy ))
- withinboredom 4y agoI've usually seen it expressed as: > instead of accepting a boolean argument, write a new function Which can be expanded to > instead of an if-statement, write a new function You can't remove branching from software (otherwise, just create a jpeg), but you can structure your software in such a way that it appears not to branch. I think it's weird, but I worked with someone like that and learned a few interesting things (for example, I usually do write a new function instead of adding an optional/boolean argument -- unless it makes things worse for the caller because the argument comes from outside the context/domain). But with all due respect to people like this, it's bananas to do it all the time.
- nivertech 4y agohttps://news.ycombinator.com/item?id=35955938 https://news.ycombinator.com/item?id=35955938