Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nice article. The problem of multiple booleans is just one instance of a more general problem: when a function takes multiple arguments of the same type (i32, String, etc.). The newtype pattern allows you to create distinct types in such cases and enforce correctness at compile time.




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

Search: