[rust-dev] Integer overflow, round -2147483648

Tony Arcieri bascule at gmail.com
Mon Jun 23 14:08:43 PDT 2014


On Mon, Jun 23, 2014 at 1:32 PM, Daniel Micay <danielmicay at gmail.com> wrote:

> It would be an enormous mistake to ship a language with region typing /
>  move semantics and worse before than Java.


You keep saying that, but if the argument is to use Swift's approach, i.e.:

Non-overflow operators: + - * / %
Overflow operators: &+ &- &* &/ &%

Or let's swap Swift's defaults if you so desire:

Overflow operators: + - * / %
Non-overflow operators: &+ &- &* &/ &%

Or even change the syntax if you so desire:

Overflow operators: + - * / %
Non-Overflow operators: +~ -~ *~ /~ %~

...then any arguments about performance are really a false dichotomy. It's
just a question of syntax and defaults. Want to perform well at TIOBE or
other (micro)benchmarks? Use the overflow operators! Want to write safe
code? Use the checked overflow operators. I really think Rust should
support both approaches, be it implemented through a type or operator or
what have you. I'm not here to bikeshed that. I just want to make sure both
approaches have a first class position in the language, and would generally
prefer but don't insist upon checked overflow being the default.

If the Rust developers insist on choosing overflow operators as the One
True Way To Do Math, well, that's your prerogative. I will probably still
choose Rust over Swift. But then I feel like Rust might be missing out on
the free lunch I expect Swift to provide, which is sad if that's the way
the cookie crumbles...

-- 
Tony Arcieri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140623/6e92694b/attachment.html>


More information about the Rust-dev mailing list