<html><head></head><body><div><br></div><div><blockquote type="cite" class="gmail_quote"><font color="#000000" face="UICTFontTextStyleBody"><span style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);">Right, you'd need to do NSString(string) as AnyObject to explicitly bridge. </span></font></blockquote></div><div><br></div><div>Okay great I'm fine with that. :)</div><div><br></div><div><blockquote type="cite" class="gmail_quote"><font color="#000000" face="UICTFontTextStyleBody"><span style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);">The @objc-ness of AnyObject is more or less an implementation detail. On Darwin platforms at least, AnyObject still has the magic ability to dispatch to all @objc methods, similar to `id` in Objective-C, which vaguely defends its @objc-ness. (If we're going to rename it, my own preference would be to drop the Any and just call it `Object`, since we don't put Any in any other protocol names.) </span></font></blockquote></div><div><br></div><div>Did I miss something again? I checked SR-0006 and it still has protocols like `Any`, `AnyIterator` or `AnyCollectionProtocol`.</div> <br><div class="bloop_sign"><div>-- <br>Adrian Zubarev</div></div> <p class="gmail_quote" style="color:#000;">Am 9. Mai 2016 um 21:38:22, Joe Groff (<a href="mailto:jgroff@apple.com">jgroff@apple.com</a>) schrieb:</p> <blockquote type="cite" class="gmail_quote"><span><div><div></div><div>
<br><blockquote type="cite">On May 6, 2016, at 12:04 AM, Adrian Zubarev via swift-evolution <swift-evolution@swift.org> wrote:
<br>
<br>Definitely a welcome change from me (+1). But this proposal makes me curious about the impact on the `AnyObject` protocol?
<br>
<br>let string = "foo"
<br>let nsString = string as AnyObject
<br>nsString.dynamicType // _NSCFConstantString.Type
<br>NSString().dynamicType // __NSCFConstantString.Type // there are two different types?
<br>
<br>This sample won’t bridge anymore if SE-0083 will be accepted.
<br></blockquote>
<br>Right, you'd need to do NSString(string) as AnyObject to explicitly bridge.
<br>
<br><blockquote type="cite">Can we also drop the @objc from `AnyObject` protocol and leave it as an implicit protocol for classes? (Personally I’d rename `AnyObject` to `AnyReference` if Swift will introduce other reference types.)
<br></blockquote>
<br>The @objc-ness of AnyObject is more or less an implementation detail. On Darwin platforms at least, AnyObject still has the magic ability to dispatch to all @objc methods, similar to `id` in Objective-C, which vaguely defends its @objc-ness. (If we're going to rename it, my own preference would be to drop the Any and just call it `Object`, since we don't put Any in any other protocol names.)
<br>
<br><blockquote type="cite">This change might allow the replacement of the `class` keyword from protocols with the implicit `AnyObject` protocol, which can be discussed in this thread: Should we rename "class" when referring to        protocol conformance?
<br>
<br>One more thing I’d like to ask: is there any possibility of adding a new `bridge` keyword, which would allow explicit bridging to a different language type (ObjC, etc. if there are any more languages we can bridge to [C or maybe one day C++])?
<br>
<br>T `bridge` U
<br>T? `bridge` U?
<br></blockquote>
<br>One could write `bridge` as a method in most cases; it doesn't need to be a keyword with special syntax, since you could write `T.bridge(U.self)` (or, if we accept https://github.com/apple/swift-evolution/pull/299, `T.bridge(U)`). Idiomatically, though, we generally use initializers for value-preserving conversions, so U(T) would be more consistent with the rest of the standard library.
<br>
<br>-Joe
<br>
<br><blockquote type="cite">The ugly NSError pattern could be rewritten and migrated to:
<br>
<br>do {
<br>try something()
<br>} catch let error {
<br>handle(error `bridge` NSError)
<br>}
<br>
<br>Is such a change complicated, what do you think?
<br>
<br>--
<br>Adrian Zubarev
<br>Sent with Airmail
<br>
<br>Am 4. Mai 2016 bei 01:50:54, Joe Groff via swift-evolution (swift-evolution@swift.org) schrieb:
<br>
<br><blockquote type="cite">Thanks everyone for the initial round of feedback. I've submitted a draft proposal:
<br>
<br>https://github.com/apple/swift-evolution/pull/289
<br>https://github.com/jckarter/swift-evolution/blob/remove-bridging-conversion-dynamic-casts/proposals/XXXX-remove-bridging-from-dynamic-casts.md
<br>
<br>-Joe
<br>_______________________________________________
<br>swift-evolution mailing list
<br>swift-evolution@swift.org
<br>https://lists.swift.org/mailman/listinfo/swift-evolution
<br></blockquote>_______________________________________________
<br>swift-evolution mailing list
<br>swift-evolution@swift.org
<br>https://lists.swift.org/mailman/listinfo/swift-evolution
<br></blockquote>
<br></div></div></span></blockquote></body></html>