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

Ints and strings are a poor example because they have a very large domain. These features are much more useful when you're talking about more complex data structures, like the intermediate representation in a compiler. I think typechecking is most useful with complex data structures, anyway - their invariants can be built into the type.

There are other languages with the ability to constrain types to specific ranges, etc. (without having to define e.g. RInt of One | Two | Three | Four | ...), but they're still pretty obscure.




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

Search: