4 ms·
This usage is very annoying. It can match on completely arbitrary conditions while pretending that they're homogeneous like conditions in ‘switch’ are supposed
by aasasd 7y ago
This usage is very annoying. It can match on completely arbitrary conditions while pretending that they're homogeneous like conditions in ‘switch’ are supposed to be. You wouldn't fire up a ‘switch ... case ...’ to check one condition, which is what you do in the “early return” pattern that's a lot better for disparate checks than switches and elses.
It also uses syntax that's different from regular C-style “I (command you) {to do stuff}”.
All that for very dubious benefit, as in I can't see any. I knew exactly one dude who insisted on writing this way, and he's also the only one I know who supported Putin, so I guess pick your choice.
- Razengan 7y agoThat correlation is hilarious.
- aasasd 7y agoThe guy also liked Microsoft's ecosystem (despite coding for a Linux backend) and drove a Chinese-made SUV. I'm comfortable writing off the `switch` pattern as another one of his idiosyncrasies. It also annoyed everyone who came across his code, just as his political views irked people outside of keyboard-mashing time.