[swift-evolution] [Discussion] Here we go again: Extension Functions

Stephen Celis stephen.celis at gmail.com
Mon Feb 29 07:15:12 CST 2016


> On Feb 29, 2016, at 3:59 AM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> I'm thinking an attribute on the closure's first parameter, for exemple (feel free to suggest other names):
>> 
>> func with<T>(value: T, body: (bound T) -> ()) -> T {
> 
> Is there a reason to avoid the obvious answer?
> 
> 	func with<T>(value: T, body: (self: T) -> ()) -> T {

I don't see any reason why that couldn't work.

With that change would the call site may change, too?

    body(self)

Stephen



More information about the swift-evolution mailing list