[swift-evolution] [Pitch] Reducing the bridging magic in dynamic casts
Joe Groff
jgroff at apple.com
Mon May 9 21:03:20 CDT 2016
> On May 9, 2016, at 2:28 PM, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
>
>
>> Right, you'd need to do NSString(string) as AnyObject to explicitly bridge.
>
> Okay great I'm fine with that. :)
>
>> 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.)
>
> Did I miss something again? I checked SR-0006 and it still has protocols like `Any`, `AnyIterator` or `AnyCollectionProtocol`.
"Any" is a typealias for the protocol type without any protocol requirements, which is natively spelled "protocol<>". "AnyIterator" and "AnyCollection" are both wrapper types for holding a value that conforms to the Iterator or Collection protocol; they aren't protocols themselves.
-Joe
More information about the swift-evolution
mailing list