Re: [swift-evolution] where clauses on enum cases

2017-03-14 Thread Slava Pestov via swift-evolution
You’re asking for GADTs: https://en.wikipedia.org/wiki/Generalized_algebraic_data_type This feature is difficult to implement correctly and efficiently and I doubt Swift will ever support it, but you never know… Slava > On Mar

[swift-evolution] where clauses on enum cases

2017-03-14 Thread Rex Fenley via swift-evolution
I've run into a problem recently when using generics with enums where I'm required to specify the type for a generic that isn't used for the enum case that's constructed. Example: protocol Mapping { associatedtype Destination } enum EvictionPolicy { case append case replace } enum