[swift-evolution] [Pitch] Allow closures/default params to satisfy protocol requirements
    Adrian Zubarev 
    adrian.zubarev at devandartist.com
       
    Tue Mar 28 02:37:41 CDT 2017
    
    
  
Theoretically speaking optional could potentially become some language sugar right?
protocol P {
    // Variable with label
    var foo(a:) : ((Int) -> Void)? { get }
     
    // more sugared version
    var foo: ((a: Int) -> Void)? { get }
}
extension P {
    // (1)
    var foo: ((a: Int) -> Void)? { return nil }
}
// Everything from above with even more sugar
protocol P {
    // default implementation (1) is inferred
    optional func foo(a: Int)
}
-- 
Adrian Zubarev
Sent with Airmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170328/6128e4b3/attachment.html>
    
    
More information about the swift-evolution
mailing list