> On Jun 28, 2016, at 3:34 PM, Matthew Johnson via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
>>> Finally, I am very concerned that there are protocols such as Collection,
>>> with many inferrable associated types, and that conforming to these
>>> protocols could become *much* uglier.

Unfortunately I have a specific use case in which this argument would be very 
strong.

Basically this:

extension TodoController : ResourceController {}

Would have to become this:

extension TodoController : ResourceController {
    public typealias CreateInput = Todo
    public typealias UpdateInput = Todo

    public typealias ListOutput = Todo
    public typealias CreateOutput = Todo
    public typealias DetailOutput = Todo
    public typealias UpdateOutput = Todo

    public typealias DetailID = String
    public typealias UpdateID = String
    public typealias DestroyID = String
}

I could reduce the amount of associated types but this would reduce the 
flexibility of the protocol by a huge factor and would make it much less 
powerful. I’m very torn about this because I do want generics to get better. 
Specifically I’m looking forward to conditional conformances. But this would be 
a too high cost imho. I know this is just one example. But maybe there are more 
examples like this out there. I have to admit this one really got to me. :(
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to