> On Dec 29, 2015, at 12:06 PM, Kevin Ballard via swift-evolution 
> <[email protected]> wrote:
> 
> The downside to this is it needs to be manually declared for each protocol. 
> But I wager that most protocols actually aren't really amenable to forwarding 
> anyway.

At least from a language-mechanics perspective, the only fundamental blocker I 
can think of that makes a protocol difficult to forward are nontrivial `Self` 
requirements, since you need a way to map from Foo<Forwarder> to Foo<Forwardee> 
anywhere the protocol requires Foo<Self>. There's quite a bit of that in the 
standard library thanks to the collection APIs, to be sure, but I wonder what 
the breakdown is in the wild for Self-inflicting protocols versus non  outside 
of the stdlib.

I like the idea of using Forwarder protocols with default implementations, 
since it's amenable to macro generation and doesn't require new language 
features, but like Matt noted, it's easy to do the wrong thing from an API 
exposure standpoint by accidentally publishing your type's FooableForwarder 
conformance when you only wanted to promise that your type was Fooable.

-Joe
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to