[swift-evolution] Proposals: (1) Forbidding custom `==` for value types, (2) `dispatch` keyword, (3) `default`-result for methods with `Self`, and (4) Poor-Mans-Existentials
Johannes Neubauer
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...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160715/6574f964/attachment.sig>
More information about the swift-evolution
mailing list