Say I'm writing a library to send / receive a given request / response.
I had the thought of doing something like:
protocol Request {
associatedtype ResponseType: Response
}
protocol Response {}
With this, you can do things like:
func request<T: Request>(_ r: T) -> T.ResponseType { }
It ends up being quite nice because you keep a strong association between the Request and Response types (and can do tricks w/ Codable).
I can't help but feeling there's a way to make this nicer… any ideas?
