> This can be done today with no syntax changes (you'd have to return optional
> or handle the nil case though):
>
> var description: String? {
> return [
> .Hearts: "♥️",
> .Spades: "♠️",
> .Diamonds: "♦️",
> .Clubs: "♣️"
> ][self]
> }
"You have to handle the nil case" is a symptom of the real problem with this
approach: you lose exhaustiveness checking.
--
Brent Royal-Gordon
Architechies
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution