[rust-dev] Appeal for CORRECT, capable, future-proof math, pre-1.0

Daniel Micay danielmicay at gmail.com
Fri Jan 10 22:05:34 PST 2014


On Sat, Jan 11, 2014 at 12:48 AM, Patrick Walton <pcwalton at mozilla.com> wrote:
> On 1/10/14 9:41 PM, Corey Richardson wrote:
>>
>> The current consensus on this subject, afaik, is the rename int/uint
>> to intptr/uintptr. They're awful names, but it frees up int for a
>> *fast* bigint type. Fast here is key. We can't have a suboptimal
>> numeric type be the recommended default. We need to perform at least
>> as well as GMP for me to even consider it. Additionally we'd have
>> generic numeric literals. I don't think anyone wants what we current
>> have for *numerics*. Fixed-size integers are necessary for some tasks,
>> but numerics is not one of them.
>
> I wasn't aware of this consensus. I'm not sure what I think; int and uint as
> they are is pretty nice for array indexing.
>
> Patrick

I think it's very important to remove the default fallback to `int` so
Rust can leave this as an explicit choice for the programmer. It's too
easy to accidentally fall back to a fixed-size signed integer and
since the length varies based on the pointer-size, you may not run
into the bugs on the platform you're developing on.

It would be nice to name them based on what they are instead of making
them out as good defaults, because this should really be an explicit
choice. High-level logic will often (but not always) want a big
integer type, and it's too easy to just use `int` because it's the
"default".


More information about the Rust-dev mailing list