[swift-evolution] ValueEnumerable protocol with derived implementation for enums
Brent Royal-Gordon
brent at architechies.com
Tue May 24 17:27:18 CDT 2016
> To me, it seems that a "magic protocol" with no public requirements, producing an internal (non-resilient) static array, is a reasonable solution that might be able to fit into the Swift 3 timeframe, and I think that'd be a huge boon to language users. I also don't think it precludes further improvements.
On the other hand, since resilience has been deferred, this also weakens the case for not using a tight type now, like:
protocol ValuesEnumerable {
static var allValues: [Self]
}
Or:
protocol ValuesEnumerable {
static var allValues: AnyForwardCollection<Self>
}
And then loosening the requirement once we have the generic features we need to do it. The pull request for `where` clauses on associated types has already been submitted, so if we're lucky, we might even get it by Swift 3. <https://github.com/apple/swift-evolution/pull/284>
> Do others agree? Disagree? Is it definitely out of scope for Swift 3 regardless of the approach we choose?
I stopped thinking about this because I assumed it was now out of scope, but that is a mere assumption. If the core team thinks they can fit it in, I'm all for it.
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list