Avatar
struct OrNone { private init() {} static let orNone = OrNone() } struct OrError { private init() {} static let orError = OrError() } struct OrDie { private init() {} static let orDie = OrDie() } func getCat(_ o: OrNone = .orNone) -> Cat? { return nil } func getCat(_ o: OrError = .orError) throws -> Cat { throw Cat.Error.fail } func getCat(_ o: OrDie) -> Cat { fatalError() }
3:34 AM
ということで
3:35 AM
3:35 AM
補完バッチリ効いてるのいいすね