
8 Surprises I learnt about Swift - ahigherugliness
http://ristkof.be/posts/8-surprises-about-swift.html
======
coldtea
> _I was surprised to find out that tuples are not AnyObjects. The reason is
> that AnyObject corresponds to an Objective-C object, an object that can
> exist in the Cocoa world. We still write apps in the Cocoa framework so
> mostly we deal with AnyObjects. And often times (in the case of strings for
> instance) there is implicit bridging between the two sorts of objects. Then
> there is also an Any object, which is not (necessarily) an AnyObject, but is
> the Swift equivalent of the Objective-C general object (represented in Swift
> by AnyObject). All very confusing, and inexplicably confusing if you
> consider that Swift had a chance to start with a clean slate._

How is that confusing, and much more "inexplicably" so?

It's clearly because Swift wanted to take advantage of its clean slate that
this is the case. So you have AnyObject for items that need the legacy
Objective-C object tree support, and Any for the Swift native equivalent.

Eventually this allows them to drop AnyObject, and keep Any when they're
finally able to go all-Swift.

