Hacker News new | ask | show | jobs
by hashmal 3346 days ago
first thing that comes to mind are bounds on integer subtypes. classic example is to declare an array to be indexed with such a type, then all out-of-bounds errors can be checked at compile time.
1 comments

GHC Haskell lets you implement that as a normal library: https://nikita-volkov.github.io/refined/

Hopefully Rust will get type-level numbers and stuff someday :)

See https://github.com/rust-lang/rfcs/pull/1931 and https://internals.rust-lang.org/t/lang-team-minutes-const-ge...

> We believe that we can have an RFC accepted and const generics available on nightly by the end of 2017. :tada: