[swift-evolution] [Pitch] Remove type inference for associated types
Paulo Faria
paulo at zewo.io
Tue Jun 28 23:45:26 CDT 2016
> On Jun 28, 2016, at 3:34 PM, Matthew Johnson via swift-evolution <swift-evolution at 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. :(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160629/e3658baa/attachment.html>
More information about the swift-evolution
mailing list