[swift-evolution] [Draft] Rename Sequence.elementsEqual
Thorsten Seitz
tseitz42 at icloud.com
Mon Oct 16 14:23:09 CDT 2017
> Am 16.10.2017 um 17:49 schrieb Jonathan Hull via swift-evolution <swift-evolution at swift.org>:
>
>
>> On Oct 16, 2017, at 7:20 AM, Xiaodi Wu <xiaodi.wu at gmail.com <mailto:xiaodi.wu at gmail.com>> wrote:
>>
>> To start with, the one you gave as an example at the beginning of this discussion: Two sets with identical elements which have different internal storage and thus give different orderings as sequences. You yourself have argued that the confusion around this is enough of a problem that we need to make a source-breaking change (renaming it) to warn people that the results of the ‘elementsEqual’ algorithm are undefined for sets and dictionaries.
>>
>> No, I am arguing that the confusion about ‘elementsEqual’ is foremost a problem with its name; the result of this operation is not at all undefined for two sets but actually clearly defined: it returns true if two sets have the same elements in the same iteration order, which is a publicly observable behavior of sets (likewise dictionaries).
>
> But that iteration order is undefined and could easily change due to changes in the private/internal structure of sets/dictionaries. Algorithms that rely on that “publicly observable behavior” (i.e. leaking of internals) will suddenly break. You keep claiming that this bug is a feature because it is the current behavior… but that is tautological reasoning.
Indeed.
-Thorsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171016/7bf7aa31/attachment.html>
More information about the swift-evolution
mailing list