Issue by BryanQuigley
Saturday Dec 13, 2014 at 03:46 GMT
For earlier discussion, see rust-lang/rust#19801
This issue was labelled with: A-an-interesting-project, E-hard in the Rust repository
It seems like a natural extension of how variables (immutable by default, mutable if specified) are defined to allow the programmer to dictate a specific range of allowed values for an integer. If I know a value is only valid between 0-1000 the sooner I declare that the better it is for catching bugs, off by one errors, and more...
I'm not sure what exact syntax would work, maybe:
x is only valid from 0-1000 inclusive.
(Apologies if this is already possible, I've been parsing the docs trying to learn Rust.)
Saturday Dec 13, 2014 at 03:46 GMT
For earlier discussion, see rust-lang/rust#19801
This issue was labelled with: A-an-interesting-project, E-hard in the Rust repository
It seems like a natural extension of how variables (immutable by default, mutable if specified) are defined to allow the programmer to dictate a specific range of allowed values for an integer. If I know a value is only valid between 0-1000 the sooner I declare that the better it is for catching bugs, off by one errors, and more...
I'm not sure what exact syntax would work, maybe:
x is only valid from 0-1000 inclusive.
(Apologies if this is already possible, I've been parsing the docs trying to learn Rust.)