[swift-evolution] Default implementation for protocols
Howard Lovatt
howard.lovatt at gmail.com
Sun Jan 31 00:22:19 CST 2016
Thanks for the feedback.
On Sunday, 31 January 2016, Chris Lattner <clattner at apple.com> wrote:
>
> > On Jan 30, 2016, at 4:48 PM, Howard Lovatt via swift-evolution <
> swift-evolution at swift.org <javascript:;>> wrote:
> >
> > Proposal
> > =======
> > Allow protocols to define a default implementation, e.g.:
> >
> > protocol Complex {
> > default var re: Double = 0
> > default var im: Double = 0
> > var mag: Double { return sqrt(re * re + im * im) }
> > // ...
> > }
>
> Hi Howard,
>
> This is a desired feature, but a surprising amount of implementation
> effort blocks “just doing it”. We hope that this will happen in Swift 3,
> but we’ll see how things work out with the other generics system
> improvements.
>
> -Chris
>
>
--
-- Howard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160131/991fd547/attachment.html>
More information about the swift-evolution
mailing list