[swift-evolution] Changing the curried static methods

Stephen Celis stephen.celis at gmail.com
Tue Mar 15 20:03:47 CDT 2016


> On Mar 14, 2016, at 1:09 PM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Note that there's a proposal open to flatten away the currying altogether:
> 
> https://github.com/apple/swift-evolution/blob/master/proposals/0042-flatten-method-types.md
> 
> I agree that it would often be more useful to bind the non-self arguments first. Maybe we could provide a different shorthand for that, though; a number of people for instance have suggested `.insetBy(10.0, 10.0)` as a possibility.

Interesting proposal! Is there a migration path for code that takes advantage of the current currying? The following is a convoluted example, but I've appreciated the flexibility in actual code:

  func flip<A, B, C>(input: A -> B -> C) -> B -> A -> C {
    return { b in { a in input(a)(b) } }
  }
  let insetBy = flip(CGRect.insetBy)
  let grow = { insetBy((-$0, -$0)) }
  grow(50)(.zero)


- Stephen


More information about the swift-evolution mailing list