Hacker News new | ask | show | jobs
by TheHalfDeafChef 1889 days ago
I consider myself an advanced-beginner programmer untested in the real world (looking for my first coding job though!), and I understood it relatively quickly. It does appear more concise than many if-else statements. After the initial “what?”, I was able to quickly parse through it. I think this is faster than using the standard form.

[edit: fixed typo]

2 comments

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.

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.

That's why I abstain when I'm oncall (or backup).

That's what the oncall bonus pay is for.

Replace alcohol with 2 hours of sleep, then :)
"faster" in which respect?
Faster to parse as a developer. I can't speak to whether computationally it is faster.

Additionally, doesn't this somewhat also bring in the methodology of dealing with the error cases first?