On Mon, Jan 13, 2014 at 4:06 PM, Tobias Müller <[email protected]> wrote: > int<l1,u1> + int<l2,u2> = int<l1+l2,u1+u2> > ... > > If the result does not fit into an int the compiler throws an error. > To resolve an error, you can: > - annotate the operands with appropriate bounds > - use a bigger type for the operation and check the result.
I remember wondering whether this type of solution would be feasible or too much of a hassle in practice. As I see it, many values which might be arithmetic operands are sizes or counts, and really ought to be size_t sized, and any mutable variable which is operated on in a loop can't be bounded with a lot more complexity, so it might lean toward the latter. _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
