chaos icon indicating copy to clipboard operation
chaos copied to clipboard

What is the benefits of not using conditions (if else, switch)?

Open tim-hub opened this issue 4 years ago • 1 comments

func myFunc(num a, num b)
     // your code
end { x > 0 : f1(x), default : f2(x) }

what is benefits of only getting conditions in function? but not using if else/switch?

tim-hub avatar Apr 22 '20 06:04 tim-hub

From what I understand, it makes horrible nested if statements with endless recursion impossible to create, and prevents the quick-and-dirty monkey patching of new conditionals to cover some unconsidered edge case that cropped up at runtime? Essentially making it impossible to create a spiderweb of independent paths that increase complexity, decrease reliability etc.

I think it's awesome. Like, slap-myself-on-the-forehead and think "why haven't I seen this until now" kind of awesome.

I imagine it might slow productivity a bit until you get used to the new paradigm, but it'd encourage good planning and forward thinking, in an ecosystem that is absolutely drowning in hastily thrown-together code (oh, the horror).

f00stx avatar Apr 22 '20 12:04 f00stx