Does that permit Brent’s use case, where it accepts one Value but returns a different one?
Conversation
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
No, adding isEqual(Value) to Value instead of “: Equatable".
1
That tweet would be the imply of a Value’s isEqual—runtime type constraint. 😔
2
Replying to
? You could implement a total isEqual(Value) depending on your semantics.
Replying to
I had assumed the real motivating case wouldn’t permit a total isEqual.
1
1
Show replies



