Avatar
うん、おそらく。
8:16 AM
32 bit が 64 bit になった🤔 import Foundation class Cat { @objc func nya() -> Int { return 3 } } class Dog { @objc func wan() -> Int32 { return 4 } } class Foo { @objc func wan() -> Double { return 5 } } func f(_ a: AnyObject) { let x = a.nya?() let y: Int32? = a.wan?() let z: Double? = a.wan?() print(type(of: x), x) print(type(of: y), y) print(type(of: z), z) } f(Dog()) Optional<Int> nil Optional<Int32> Optional(4) Optional<Double> Optional(3.22526e-319)
8:20 AM
↓死んだ。 import Foundation class Cat { @objc func nya() -> Int { return 3 } } class Dog { @objc func wan() -> Int { return 4 } } class Foo { @objc func wan() -> X { return X(value: 5) } } @objc class X: NSObject { var value: Int init(value: Int) { self.value = value } } func f(_ a: AnyObject) { let x = a.nya?() let y: Int? = a.wan?() let z: X? = a.wan?() print(type(of: x), x) print(type(of: y), y) print(type(of: z), z) } f(Dog()) Segmentation fault: 11