Conversation
That requires making a 1-to-1 relationship between each `Smashable`-adopter and each `Value`-adopter Does that permit Brent’s use case, where it accepts one Value but returns a different one? Oh, the associated type solution wouldn’t permit that, no. I’m looking at your original one. How can valueBySmashing… take a Foo and return a Bar? It couldn’t without the <T, U> formulation from my comment. Didn’t see that he needed that. Updated. This doesn't work — but I'm not sure why it doesn't work. in this, U is determined by the caller and can be anything. But impl always returns Bar. Yep. Okay. No way to fix this without making Value hetero-equatable, as said. :( In other words, falling back to guard let x = x as Value else { abort }? No, adding isEqual(Value) to Value instead of “: Equatable". Yeah, really want protocol *type* to be Equatable, but can't do that yet. What if Value was an enum with associated values, not protocol?