Hacker News new | ask | show | jobs
by drauh 3627 days ago
Granted, I'm a mostly self-taught programmer, but I would have thought that if something appears in formal logic,[0] it should have an analog in a programming language.

Even standard algorithms like quicksort[1] use conditionals.

And, while I can see how massive switch statements suck, normal conditionals are common in everyday life: "If they don't have a dark roast coffee, get me a medium roast."

All of which is to say, I really don't understand what he's getting at. The last example he gave seemed to make things even more complicated, and it basically renamed "true" and "false" to more descriptive things (forRealOptions, dryRunOptions), which seems to my untrained eye to boil down to the moral equivalent of a C enum.

[0] https://en.wikipedia.org/wiki/Material_conditional

[1] https://en.wikipedia.org/wiki/Quicksort#Algorithm

1 comments

> normal conditionals are common in everyday life: "If they don't have a dark roast coffee, get me a medium roast."

"They had dark roast so I got you nothing as requested."

IOW, this program is either incomplete or wrong. Cf. "Get me the darkest roast they have." - ifless, concise, robust.

So if it's an undrinkable mud you are still happy, code executed perfectly :)
What if I want a vanilla latte instead?