[swift-evolution] [Draft] Rename Sequence.elementsEqual
Thorsten Seitz
tseitz42 at icloud.com
Wed Oct 18 17:44:14 CDT 2017
> Am 18.10.2017 um 22:36 schrieb Michael Ilseman <milseman at apple.com>:
>> To get back to the topic at hand: I propose to differentiate between unordered and ordered collections because I think that this is an important distinction with tractable impact on algorithms (as shown above). The method `elementsEqual` would be part of the ordered sequence protocol and I would suggest the name `elementsPairwiseEqual`.
>>
>
> You are free to propose that and justify its cost. You'll probably want to plan on how you’ll present the cost/benefit analysis for the feedback of “why not just slap a warning on Set/Dictionary?”
The warning will have to be slapped on `Sequence` because I and others can write types adopting Sequence but being unordered.
And it will have to be slapped on every public generic function written by anyone which takes a Sequence as argument and internally uses `elementsEqual` on that argument, so that the user of such an API knows that he cannot use that function with a Set or another unordered subtype of Sequence.
-Thorsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171019/9f8d5076/attachment.html>
More information about the swift-evolution
mailing list