4 ms·
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.
by TheHalfDeafChef 5y 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]
- arielserafini 5y ago"faster" in which respect?
- TheHalfDeafChef 5y agoFaster 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?
- deleted 5y ago[deleted]
- t-writescode 5y agoA 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.
- tantalor 5y agoThat's why I abstain when I'm oncall (or backup). That's what the oncall bonus pay is for.
- t-writescode 5y agoReplace alcohol with 2 hours of sleep, then :)
- TeMPOraL 5y agoThere 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.
- deleted 5y ago[deleted]