News for hackers. Stuff that matters.
Re:Programming Patterns I Like by rrobukef on Saturday June 29, 2019 @06:29AM (#20311797)
The comment twice stands for some complex logic with side-effects which calculates value. You shouldn't put that in a ternary if, in most languages you can't.

And even then I would reverse the order, placing the exceptional and short case first.

Moving the code: why? You have a perfectly encapsulated function. If you need to, you have more problems with shadowing variables, functions and with return types.

For functional languages: doesn't Haskell explicitly have guard pattern? I thought the general guidelines favored matching and guards over if statements.

There are no comments on this comment yet.