[swift-evolution] [Accepted] SE-0072: Fully eliminate implicit bridging conversions from Swift
Jacob Bandes-Storch
jtbandes at gmail.com
Mon May 9 12:12:56 CDT 2016
Maybe I made a mistake when testing, but I thought I was able to convert a
negative Int to a large UInt by going through NSNumber (it didn't return
nil from the as? cast).
On Mon, May 9, 2016 at 10:11 AM Joe Groff via swift-evolution <
swift-evolution at swift.org> wrote:
>
> > 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
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160509/35503490/attachment.html>
More information about the swift-evolution
mailing list