Hacker News new | past | comments | ask | show | jobs | submit login

Sibling comment mentioned pattern matching, but didn’t point out the important point that the rustc compiler makes sure all patterns matches are exhaustive.

To use a C example, if you add a new definition/variant to an enum, suddenly all switch statements over that enum will fail to compile (unless there is a default: branch).

This does eliminate a large swatch of logic errors, though by no means all.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: