Hi SE,
I’m pondering some esoteric type stuff as I’m sketching out an improved
date/time library (https://github.com/davedelong/Chronology
<https://github.com/davedelong/Chronology>), and I’m wondering two things:
1️⃣ Is there a way to express a type that does *not* conform to a protocol?
For example, let’s say I have three protocols:
protocol YearHaving { var year: Int }
protocol MonthHaving { var month: Int }
protocol DayHaving { var day: Int }
typealias DateHaving = YearHaving & MonthHaving & DayHaving
Now, I want to allow for some adjustments to values that have these types:
extension DayHaving {
func removingDay() → Self & ¬DayHaving // whatever type “self” is, except
it does not conform to “DayHaving”, because you just removed the day value
}
Is this possible?
2️⃣ If this is not possible, would it be hard to add something like this in?
Dave_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution