[swift-evolution] [Proposal] Allow protocols to require functions with default parameter values.

Vatsal Manot vatsal.manot at yahoo.com
Sat Jan 16 04:05:45 CST 2016


It serves as a better (if not simpler) substitute for the following pattern:
 
protocol Protocol
{
    typealias Argument
    
    func function()
    func function(_: Argument)
}
 
> On 16-Jan-2016, at 3:29 PM, 肇鑫 <owenzx at gmail.com> wrote:
> 
> I wonder where is the good for a protocol designer on this?
> 
> zhaoxin
> 
> On Sat, Jan 16, 2016 at 5:23 PM, Vatsal Manot via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> Currently, the following the code fails with multiple errors:
> 
> protocol Protocol
> {
>     typealias Argument
> 
>     func function(argument: Argument = default)
> }
> 
> I propose that we allow protocols to require functions with default parameter values. I can’t see any disadvantages to this, and the change would only be additive.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> 
> 
> -- 
> 
> Owen Zhao

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


More information about the swift-evolution mailing list