[swift-evolution] [Pitch] Fully eliminate implicit bridging conversions in Swift 3

Greg Parker gparker at apple.com
Tue Apr 19 09:28:54 CDT 2016


> On Apr 18, 2016, at 8:21 PM, Joe Pamer via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I propose that we fully eliminate implicit bridging conversions in Swift 3. This would mean that some users might have to introduce introduce a few more ‘as’ casts in their code, but we would remove another special case from Swift's type system  and be able to further simplify the compiler. If anyone is curious and would like to take this model for a spin, I’ve pushed an experimental branch that implements this proposed change, inhibit-implicit-conversions.

What happens with string literals? Are they implicitly converted to NSString as necessary? Which of the following will be legal?

    import Foundation
    func s(_ str: String) { }
    func ns(_ str: NSString) { }

    let str: String = "foo"
    let nsstr: NSString = "foo"

    NSLog("foo")
    NSLog(str)
    NSLog(nsstr)

    s("foo")
    s(str)
    s(nsstr)

    ns("foo")
    ns(str)
    ns(nsstr)


-- 
Greg Parker     gparker at apple.com     Runtime Wrangler


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160419/f7c018bf/attachment.html>


More information about the swift-evolution mailing list