Avatar
Kotlin と言えば、この前 @omochimetaru と話してた Ceylon : Anything : Null = Kotlin : Any? : Nothing? の話を整理して Qiita に書きたい。 (edited)
3:44 AM
typealias Anything = Any? typealias Null = Nothing? とすれば Ceylon と同じになる。
3:45 AM
typealias Object = Any これもいるか。
3:46 AM
で、これと関連して、 Swift の Never が bottom type になるかもという話も興味深い。
3:48 AM
Joe Groff の言ってる↓がもし実現されるなら https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170213/032267.html IMO, if we accept a single error type per function, there could be a simpler model for this. We could say that the `throws` type is a generic parameter of all function types, and it defaults to the uninhabited `Never` type for functions that don't throw. () -> () == () throws Never -> () () throws -> () == () throws Error -> () In this model, you'd get many benefits: - `rethrows` could become first-class, reducing down to just polymorphic `throws`: func foo(_: () throws -> ()) rethrows // Swift 3 func foo<T: Error>(_: () throws T -> ()) throws T // Swift X
3:48 AM
Never が bottom type でないと辻褄が合わない。