[swift-evolution] [Proposal Draft] automatic protocol forwarding

Dave Abrahams dabrahams at apple.com
Tue Dec 29 17:32:29 CST 2015

> On Dec 29, 2015, at 8:37 AM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
> Motivation
> Delegation is a robust, composition oriented design technique that keeps interface and implementation inheritance separate. The primary drawback to this technique is that it requires a lot of manual boilerplate to forward implemenation to the implementing member. This proposal eliminates the need to write such boilerplate manually, thus making delegation-based designs much more convenient and attractive.
> This proposal may also serve as the foundation for a future enhancement allowing a very concise “newtype” declaration.

Thanks for proposing this, Matthew!

The biggest thing missing here IMO (which has been missing from most of the other proposals I’ve seen) are examples of real-world problems solved by this proposal.  I have no doubt some forwarding mechanism would be a huge benefit, but without clear examples, how do I know that this proposal actually addresses the need?  One approach might be to show how the Lazy Collections subsystem in the standard library can be rewritten more simply using this mechanism.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151229/f9ca5506/attachment.html>

More information about the swift-evolution mailing list