-
Notifications
You must be signed in to change notification settings - Fork 10.5k
FloatingPoint should imply Hashable. #7870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FloatingPoint should imply Hashable. #7870
Conversation
@swift-ci Please smoke test. |
I'm not sure why FloatingPoint would imply Hashable. The two concepts (in the technical sense) have nothing to do with each other. |
on Thu Mar 02 2017, Jordan Rose <notifications-AT-i.8713187.xyz> wrote:
I'm not sure *why* FloatingPoint would imply Hashable. The two
concepts (in the technical sense) have nothing to do with each other.
If you can implement hashability in terms of existing FloatingPoint
primitives, they do. Can you, @stephentyrone?
…--
-Dave
|
That's still not true. You can implement Collection on any BinaryInteger type to give you a collection of Bools, but it doesn't mean they're related concepts. |
@jrose-apple That's a fair point, and with conditional conformance we probably don't need this. Without conditional conformance, it's something of a minor pain, forcing you to define your own FloatingPoint + Hashable protocol. =) |
@jrose-apple @stephentyrone |
That's new information that I'm not sure is well-established. I'd say Hashable is even more "core" than Comparable, but that still doesn't mean it has anything to do with FloatingPoint. It's not like it's hard or less correct to make it an additional constraint on your generic functions. (I'm not even against providing a default implementation. It just bothers me to see unrelated protocols connected together because it's convenient.) |
I don't buy the premise that they're unrelated. BTW, |
If this is the standard, then yes it should conform to Hashable, and it is a bug for it not to. |
This is a bug fix adding conformance to Hashable to the FloatingPoint protocol. The concrete types already conform.
Resolves SR-4132.