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

Matthew Johnson matthew at anandabits.com
Tue Dec 29 17:40:16 CST 2015


> On Dec 29, 2015, at 5:32 PM, Dave Abrahams <dabrahams at apple.com> wrote:
> 
> 
>> On Dec 29, 2015, at 8:37 AM, Matthew Johnson via swift-evolution <swift-evolution at swift.org <mailto: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.
> 
> -Dave
> 

Thanks for the feedback Dave!  I agree that the motivation section is a bit light and will work on filling it out with more detail, including specific examples of how it could be used to address specific problems.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151229/22439bed/attachment.html>


More information about the swift-evolution mailing list