27 ms·
Huh. Looking at the code snippets, I find this: func g(a: Int -> Int) -> Int -> Int { ... } // old way, Swift 2 much easier to read than this: func
by ubertaco 10y ago
Huh.
Looking at the code snippets, I find this:
func g(a: Int -> Int) -> Int -> Int { ... } // old way, Swift 2
much easier to read than this:
func g(a: (Int) -> Int) -> (Int) -> Int { ... } // new way, Swift 3
The old way is obvious: g takes a function from Int to Int, along with an Int, and produces an Int -- and I can tell that it's curried. It reads just like a type signature from any given ML.
The new way confused me at a glance, because my eyes got lost in all the parens and I read (a: (Int) -> Int) as (a: (Int -> Int), with a missing paren, which threw everything after it off and made it confusing.
It just adds another, unnecessary layer of parens. Weird.