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

And modify the switch statement to be able to ensure that all variants are handled.


Exactly, since messing around with OCaml/F#/Rust I feel like sum-types + exhaustive match (with deconstruction) is such a powerful construct to prevent logic errors and ensure maintainability, that every language without it feels so limited.


Yep, one of the reasons I could never be happy with Go.

Union types and type-classes are of similar importance. Any modern language not having them (or an equal powerful feature) just feels sad.




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

Search: