Works on Linux :) On Wed, Aug 24, 2016 at 9:44 PM, Charles Srstka <[email protected]> wrote:
> On Aug 24, 2016, at 7:42 PM, Xiaodi Wu <[email protected]> wrote: > > > import Foundation > > let foo: Any = "Hello" > type(of: foo) == String.self // true > type(of: foo) == NSString.self // false > > let bar: Any = "Hello" as NSString > type(of: bar) == String.self // false > type(of: bar) == NSString.self // true > > Why not this? > > > Because if you actually try that, it doesn’t work. type(of: bar) == > NSString.self actually returns false, not true, because the actual instance > belongs to a private subclass of NSString, not NSString itself. type(of: > bar) == NSClassFromString(“__NSCFString”) works, but that doesn’t really > help us. > > Charles >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
