On Wed, Jun 18, 2014 at 10:08 AM, Gábor Lehel <[email protected]> wrote: > > # Between a rock and a hard place > > Having dispatched the "easy" cases above, for category #3 we're left > between the rock (wraparound on overflow is wrong) and the hard place > (checking for overflow is slow). > > Even here, we may have options. >
I really like what Swift did: define two sets of operators, a default one which checks/errors on overflow, and a second set of "overflow operators" (which look like &+ &- etc) when you need the performance of unchecked operations or otherwise desire overflow behavior: https://developer.apple.com/library/prerelease/ios/documentation/swift/conceptual/swift_programming_language/AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-XID_37 -- Tony Arcieri
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
