[swift-evolution] Warning for possible overflow or optional

Dave Abrahams dabrahams at apple.com
Tue Feb 16 13:29:26 CST 2016

on Tue Feb 16 2016, David Turnbull <swift-evolution at swift.org> wrote:

> Can you show some examples where and why you use not-Int types and this is
> a problem? What you're suggesting will be a burden to those of us who need
> bitwise optimizations or work with C APIs.
> My last week was spent reading files with huffman coding. So I had no
> choice but to use bitwise operations. My experience is that Swift got this
> right (except for "truncatingBitPattern" taking up 25% of an 80 column
> line).

Suggestions for improved names welcomed.

> So my question is, "why are you not using Int?" There's plenty of use
> cases, you just haven't stated yours so we can't understand why the current
> system is failing you.
> Safety does not mean you can easily write code that crashes once it is
>> deployed….
> var a = [Int](); a[0]=99
> That was pretty easy. I don't buy into this argument. If you don't want an
> out of bounds error, you either make sure you don't math your way out of
> bounds or you check every time before you subscript. I don't see why an
> integer conversion should be any different.
> -david
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list