Swift generics: copying and pasting my code for T? so that it can also work for [T], instead of writing it once with id.
@jckarter Aha, I was used to the way Python does it. Good to know. Can you do that with an operator or only a named method?
-
-
@mjtsai The way method references are "curried" means you'd need a separate overload for => taking (T, U) -> V functions… -
@jckarter I was more thinking about getting a method reference from an operator. For example, I can write Int.successor but not Int.+ or + - View other replies
-
-
@Callionica@mjtsai You can also enclose the operator in parens, like Haskell: let plus: (Int, Int) -> Int = (+) -
-
-
@mjtsai (And the currying vs flat type issue should be addressed by https://github.com/apple/swift-evolution/blob/master/proposals/0042-flatten-method-types.md … in Swift 3.) -
@mjtsai …but in principle all function references, whether to methods, free functions, operators, or closures, behave similarly.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Michael Tsai
Joe Groff
Callionica