Avatar
22:51 niw@tpurr:~/Desktop $ cat a.swift let b: Bool = nil as String? is AnyObject print(b) 22:51 niw@tpurr:~/Desktop $ swiftc a.swift 2>/dev/null && ./a false (edited)
5:54 AM
むむむ...
5:58 AM
22:57 niw@tpurr:~/Desktop $ cat a.swift import Foundation let n: NSString = "a" let b: Bool = nil as String? is AnyObject print(b) 22:57 niw@tpurr:~/Desktop $ swiftc a.swift 2>/dev/null && ./a true (edited)
5:58 AM
trueになった...
5:58 AM
まじか...
5:58 AM
$ otool -L ./a ./a: /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1675.129.0) /usr/lib/swift/libswiftCore.dylib (compatibility version 1.0.0, current version 1103.8.25) /usr/lib/swift/libswiftFoundation.dylib (compatibility version 1.0.0, current version 0.0.0)
5:58 AM
Foundation.framework がリンクされてるかどうかで挙動がかわるっぽい? (edited)
6:01 AM
23:00 niw@tpurr:~/Desktop $ cat a.swift import Foundation let n: Data? = nil let b: Bool = nil as String? is AnyObject print(b) 23:00 niw@tpurr:~/Desktop $ swiftc a.swift 2>/dev/null && ./a false 23:00 niw@tpurr:~/Desktop $ otool -L ./a ./a: /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1) /usr/lib/swift/libswiftCore.dylib (compatibility version 1.0.0, current version 1103.8.25) (edited)
6:01 AM
えーっということは Foundation.framework がない場合の import Foundation では挙動が変わらないと... (edited)