[swift-evolution] [Proposal] Make optional protocol methods first class citizens

Kurt Werle kurt at circlew.org
Wed Mar 30 10:02:05 CDT 2016

Another alternative is to add a protocol extension with
blank/harmless/default methods for things that are optional and always call

On Wed, Mar 30, 2016 at 7:18 AM, Haravikk via swift-evolution <
swift-evolution at swift.org> wrote:

> I’m not sure, why not just define an additional protocol with the optional
> method(s) you’d like to add? The whole point of protocols is to guarantee
> access to some baseline capability, so I’m not sure that optional
> capabilities are well covered except by adding new protocols that extend
> each other.
> Objective-C conversion has the ability because Objective-C is unusual by
> comparison thanks to its ability to have “method calls” (messages) with no
> actual destination. I think it’s good for Swift to be more structured and
> strict than that.
> > On 30 Mar 2016, at 15:08, Yuval Tal via swift-evolution <
> swift-evolution at swift.org> wrote:
> >
> > Hi,
> >
> > I find that optional protocol methods to be very useful. However, there
> is a caveat -- it needs to be mapped to @objc. This puts a set of
> limitations, such as: structures cannot be used as parameters as it does
> not map to objective-c. What do you think about removing the requirement of
> using @objc and allow to create optional methods without these limitations?
> >
> > Thank you,
> >
> > -Yuval
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

kurt at CircleW.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160330/5eb9832b/attachment.html>

More information about the swift-evolution mailing list