Swift generics: copying and pasting my code for T? so that it can also work for [T], instead of writing it once with id.
-
-
@mjtsai The generics features we're planning for after 3.0 should make it easier to work with Any and other dynamic types. -
@jckarter That would be nice. Right now, Any is hard to do much with. -
@mjtsai With some helper functions, you can get pretty lightweight syntax for forcing Any into static contexts: https://gist.github.com/jckarter/2762c4fe91d8eba4b1ce27060b4c601d … -
@jckarter That is wild. How is it that if x is a Derived and I do (x=>Base.f)() it ends up calling Derived.f()? -
@mjtsai Base.f doesn't pick a method implementation until you give it a `self` parameter. -
@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? - View other replies
-
@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
- Show more
-
-
-
@mjtsai If they also both conform to another protocol, you can do this (which admittedly belongs in the stdlib): https://gist.github.com/jckarter/2664acba1806b29c4674a8643b71cdd2 … -
@jckarter I don’t think that really helps me in this case (making something like XCTAssertEqual()), but it’s a good tip. Thanks.
-
-
-
@mjtsai@jckarter http://www.callionica.com/developer/#any-equals … for a partial impl of Any equality with a ton of caveats. Also links to Twitter discussion. -
-
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