[swift-evolution] Refining SE-0185: Should providing a custom == suppress the default hashValue?
jgroff at apple.com
Fri Dec 15 12:15:34 CST 2017
> On Dec 15, 2017, at 10:08 AM, Wallacy <wallacyf at gmail.com> wrote:
> Is possible to make the compile check what is used inside of == and then provide the hash value? And if compile cannot check (for whatever reason) what’s properties is used inside == then raise a compile error?
That kind of analysis would be brittle and error-prone. As Tony noted, it might be interesting at some point to have a more declarative means of describing what properties get used to synthesize structural operations on a type, which might allow you to override the default behavior in one place and still get consistent synthesized operations in terms of a different set of properties. That would be a whole new feature, though, that would take longer to discuss and design.
More information about the swift-evolution