[swift-evolution] [Proposal] Make optional protocol methods first class citizens
adrian.kashivskyy at me.com
Thu Mar 31 16:21:21 CDT 2016
I think it's a bad idea because current model (with no optional methods) encourages decomposing protocols into smaller ones, thus discouraging partial functions and making our code safer and more predictable.
In my opinion, right now, if you really need an optional protocol method, consider adding a default implementation for it. You'd be surprised how often it's enough to satisfy the need for an optional method.
> Wiadomość napisana przez Yuval Tal via swift-evolution <swift-evolution at swift.org> w dniu 30.03.2016, o godz. 16:08:
> 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,
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution