On Sun, Jan 12, 2014 at 1:23 PM, Tobias Müller <trop...@bluewin.ch> wrote: > Isaac Dupree > <m...@isaac.cedarswampstudios.org> wrote: >> In general, Rust is a systems language, so fixed-size integral types are >> important to have. They are better-behaved than in C and C++ in that >> signed types are modulo, not undefined behaviour, on overflow. It could >> be nice to have integral types that are task-failure on overflow as an >> option too. As you note, bignum integers are important too; it's good >> they're available. I think bignum rationals would be a fine additional >> choice to have (Haskell and GMP offer them, for example). > > Wrapping overflow is just as bad as undefined behavior IMO.
Do you know what undefined behavior is? It doesn't mean unspecified. > I cannot remember a single case of using signed integers where wrapping would > make any sense. It often makes sense in codecs, hashing algorithms and cryptography. If you don't have clear bounds and don't want modular arithmetic, you need big integers. > And you lose some optimization opportunities. It's treated as undefined because there are more optimization opportunities that way. > So why not take the path of the rust memory management and enforce bounds > statically? It would need annotations on the types, like lifetimes, but it > would be very rusty. Like C but safe. Rust isn't supposed to be really hard to write. Complex dependent typing would _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev