News for hackers. Stuff that matters.
Re:Using the switch(true) pattern in JavaScript by t-writescode on Monday April 12, 2021 @03:46PM (#26784225)
A lot of the code you're going to have to be dealing with in the wild is going to look fine, until it breaks at 2am on a Saturday and you're 3 drinks in and production is down.

You're going to hate your former cleverness then.

Re:Using the switch(true) pattern in JavaScript by TeMPOraL on Monday April 12, 2021 @06:21PM (#26785913)
There should be a rule that forbids applying this reasoning to code that isn't triple-nested template SFINAE mess, or a code-generating-code-generating-code-generating-code Lisp macro.

This pattern isn't "cleverness", it's just a readability-improving trick that's cheap to figure out. The hundred seconds you spend on it seeing it for the first time is a one-time cost.

Re:Using the switch(true) pattern in JavaScript by tantalor on Monday April 12, 2021 @03:49PM (#26784247)
That's why I abstain when I'm oncall (or backup).

That's what the oncall bonus pay is for.

Re:Using the switch(true) pattern in JavaScript by t-writescode on Monday April 12, 2021 @03:55PM (#26784332)
Replace alcohol with 2 hours of sleep, then :)