[swift-evolution] Proposals: (1) Forbidding custom `==` for value types, (2) `dispatch` keyword, (3) `default`-result for methods with `Self`, and (4) Poor-Mans-Existentials
neubauer at kingsware.de
Fri Jul 15 11:12:20 CDT 2016
> Am 15.07.2016 um 15:19 schrieb Shawn Erickson <shawnce at gmail.com>:
> Additional two "things" maybe considered equal in the chosen problem domain despite their identity (memory location, etc.) being different. Having the ability to supply custom hash and equality for types can be a useful tool in a developers toolbox. For example two pathways of code may create what is actually the same thing (say a reference to the same file on disk) then want to work with stdlib set and/or dictionary with the equivalent things being resolved correctly, etc.
> To remove custom equality will limit some designs and to force identity based equality with present similar problems on the other end of the spectrum.
It is only for value types. For reference types, which have an identity, you are right, but it doesn’t hold for values.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
More information about the swift-evolution