[swift-evolution] [Draft] Rename Sequence.elementsEqual

Adam Kemp adam_kemp at apple.com
Tue Oct 17 11:44:00 CDT 2017



> On Oct 16, 2017, at 11:06 PM, Thorsten Seitz <tseitz42 at icloud.com> wrote:
> 
> The new language features (which are sorely needed anyway) are not necessary for the proposed solution of splitting the protocol. They are necessary to fix or improve the definition of map which is currently lacking as well because it always returns an Array.
> Alternatively we can continue to live with that. This is a separate question.

The language change would be necessary to avoid to consequences I described if you split the protocol. If there are other benefits to that feature then that’s not relevant to this discussion. The point is whether the proposed world where Sequence is split into two protocols would be practical to use, and your suggestion for how to make it work was to add a feature to the language.

I’m not sure how that hypothetical feature relates to the current return type of map being an array. C# doesn’t have your feature, and yet Select takes an IEnumerable<T> and returns IEnumerable<T>. I think the fact that Swift’s map returns an array instead of a Sequence has more to do with other library design decisions. As far as I can tell there’s no reason it couldn’t have been the same as .Net with the current type system.

Your proposal, on the other hand, would require a new type system feature not present in either Swift or C# just to make it tolerable, and I still haven’t seen anyone in this long thread lay out any evidence of a real problem being solved.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171017/a4345d1c/attachment.html>


More information about the swift-evolution mailing list