> On Apr 19, 2016, at 7:28 AM, Greg Parker <[email protected]> wrote:
>
>
>> On Apr 18, 2016, at 8:21 PM, Joe Pamer via swift-evolution
>> <[email protected] <mailto:[email protected]>> 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?
Sort of - yes. The types of literal expressions are always inferred from
context, so for string literals they will be inferred as NSString or String 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”)
legal
> NSLog(str)
legal - the NSLog initializer is imported as having type func NSLog(_ format:
String, _ args: CVarArg...)
> NSLog(nstr)
illegal, per the imported initializer declaration above
>
> s("foo”)
legal
> s(str)
legal
> s(nsstr)
illegal
>
> ns("foo”)
legal
> ns(str)
illegal
> ns(nsstr)
legal
Thanks,
- Joe
>
> --
> Greg Parker [email protected] <mailto:[email protected]> Runtime
> Wrangler
>
>
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution