4 ms·
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 err
by hashmal 9y 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.
- floatboth 9y agoGHC Haskell lets you implement that as a normal library: https://nikita-volkov.github.io/refined/ https://nikita-volkov.github.io/refined/ Hopefully Rust will get type-level numbers and stuff someday :)
- steveklabnik 9y agoSee https://github.com/rust-lang/rfcs/pull/1931 https://github.com/rust-lang/rfcs/pull/1931 and https://internals.rust-lang.org/t/lang-team-minutes-const-generics/5090 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: