That requires making a 1-to-1 relationship between each `Smashable`-adopter and each `Value`-adopter
Conversation
1
Does that permit Brent’s use case, where it accepts one Value but returns a different one?
2
1
I’m looking at your original one. How can valueBySmashing… take a Foo and return a Bar?
2
It couldn’t without the <T, U> formulation from my comment. Didn’t see that he needed that. Updated.
1
This doesn't work — but I'm not sure why it doesn't work.
2
in this, U is determined by the caller and can be anything. But impl always returns Bar.
2
Yep. Okay. No way to fix this without making Value hetero-equatable, as said. :(
3
In other words, falling back to guard let x = x as Value else { abort }?
1
Replying to
No, adding isEqual(Value) to Value instead of “: Equatable".
Replying to
That tweet would be the imply of a Value’s isEqual—runtime type constraint. 😔
2
? You could implement a total isEqual(Value) depending on your semantics.
1
Show replies



