[swift-evolution] [Accepted] SE-0072: Fully eliminate implicit bridging conversions from Swift

Joe Groff jgroff at apple.com
Mon May 9 12:10:54 CDT 2016


> On May 7, 2016, at 1:23 PM, Zach Waldowski via swift-evolution <swift-evolution at swift.org> wrote:
> 
> On Fri, May 6, 2016, at 11:20 PM, Charles Srstka via swift-evolution wrote:
>> let int = num as? Int // 5
>> let float = num as? Float // 5
>> let int32 = num as? Int32 // nil!
> That specific behavior with Int32 seems to be an oversight in the stdlib.

It wasn't an oversight. At the time of Swift 1.0, bridging a type implied bidirectional implicit conversions, and if *every* integer type were bridgeable, it would be possible to unsafely implicitly convert between any two integer types by hopping through NSNumber. Now that we've eliminated these implicit conversions, we could consider bridging more types. Do you want to start another thread to discuss that idea?

-Joe


More information about the swift-evolution mailing list