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

2017-10-24 Thread Thorsten Seitz via swift-evolution
> Am 19.10.2017 um 22:49 schrieb Adam Kemp : > >> >> On Oct 18, 2017, at 9:58 PM, Thorsten Seitz via swift-evolution >> > wrote: >> >> In your earlier emails you wrote >> >> "To make it concrete, say you write

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

2017-10-19 Thread Adam Kemp via swift-evolution
> On Oct 18, 2017, at 9:58 PM, Thorsten Seitz via swift-evolution > wrote: > > In your earlier emails you wrote > > "To make it concrete, say you write a function that just wraps map: > func firstNames(ofPeople people: Sequence) -> Sequence { > return people.map {

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

2017-10-19 Thread David Sweeris via swift-evolution
Oh, this is weird... I replied to a different thread an hour ago. Somehow that message hasn't posted yet, but this one from three days ago apparently got reposted? Weird. > On Oct 19, 2017, at 12:11 PM, David Sweeris via swift-evolution > wrote: > > > On Oct 16,

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

2017-10-19 Thread David Sweeris via swift-evolution
> On Oct 16, 2017, at 10:42, BJ Homer via swift-evolution > wrote: > >>> On Oct 16, 2017, at 8:20 AM, Thorsten Seitz via swift-evolution >>> wrote: >>> >>> Am 16.10.2017 um 07:19 schrieb Xiaodi Wu : >> >>> What

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

2017-10-18 Thread Thorsten Seitz via swift-evolution
In your earlier emails you wrote "To make it concrete, say you write a function that just wraps map: func firstNames(ofPeople people: Sequence) -> Sequence { return people.map { $0.firstName } } I want that function to work on both ordered and unordered Sequences, and if you start with an

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

2017-10-18 Thread Thorsten Seitz via swift-evolution
> Am 19.10.2017 um 01:13 schrieb Adam Kemp : > > >> On Oct 18, 2017, at 3:38 PM, Thorsten Seitz > > wrote: >> >> Now this is not production code (hopefully) but it demonstrates the problem. > > A single StackOverflow post

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

2017-10-18 Thread Adam Kemp via swift-evolution
Please re-read my earlier emails with concrete examples of problems this split would cause: https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20171016/040501.html

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

2017-10-18 Thread Thorsten Seitz via swift-evolution
> Am 18.10.2017 um 22:04 schrieb Adam Kemp : > > >> On Oct 18, 2017, at 12:25 PM, Thorsten Seitz via swift-evolution >> wrote: >> >> Therefore having `elementsEqual` as API for unordered collections is a >> source of bugs … > > You keep

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

2017-10-18 Thread Adam Kemp via swift-evolution
> On Oct 18, 2017, at 3:38 PM, Thorsten Seitz wrote: > > Now this is not production code (hopefully) but it demonstrates the problem. A single StackOverflow post is not convincing evidence of a problem that leads to many real-world bugs. No one here would dispute that

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

2017-10-18 Thread Thorsten Seitz via swift-evolution
> Am 18.10.2017 um 22:36 schrieb Michael Ilseman : >> 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

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

2017-10-18 Thread Thorsten Seitz via swift-evolution
> Am 18.10.2017 um 22:31 schrieb Adam Kemp : > > >> On Oct 18, 2017, at 1:20 PM, David Sweeris > > wrote: >> >> How many bugs have been caused by floating point types violating the >> programmer's mental model of how

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

2017-10-18 Thread Thorsten Seitz via swift-evolution
> Am 18.10.2017 um 22:36 schrieb Michael Ilseman : > > > >> On Oct 18, 2017, at 12:24 PM, Thorsten Seitz > > wrote: >> >>> >>> Am 17.10.2017 um 20:47 schrieb Michael Ilseman via swift-evolution >>>

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

2017-10-18 Thread Michael Ilseman via swift-evolution
> On Oct 18, 2017, at 12:24 PM, Thorsten Seitz wrote: > >> >> Am 17.10.2017 um 20:47 schrieb Michael Ilseman via swift-evolution >> >: >> >> >> >>> On Oct 17, 2017, at 10:15 AM, Kevin Nattinger via

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

2017-10-18 Thread Adam Kemp via swift-evolution
> On Oct 18, 2017, at 1:20 PM, David Sweeris wrote: > > How many bugs have been caused by floating point types violating the > programmer's mental model of how numbers work? To me, their both in the same > category... both involve specific types that claim to adhere to a

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

2017-10-18 Thread David Sweeris via swift-evolution
> On Oct 18, 2017, at 1:04 PM, Adam Kemp via swift-evolution > wrote: > > >> On Oct 18, 2017, at 12:25 PM, Thorsten Seitz via swift-evolution >> wrote: >> >> Therefore having `elementsEqual` as API for unordered collections is a >>

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

2017-10-18 Thread Adam Kemp via swift-evolution
> On Oct 18, 2017, at 12:25 PM, Thorsten Seitz via swift-evolution > wrote: > > Therefore having `elementsEqual` as API for unordered collections is a source > of bugs … You keep saying that, and yet after repeated requests to provide evidence you still have not

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

2017-10-18 Thread Thorsten Seitz via swift-evolution
> Am 17.10.2017 um 20:47 schrieb Michael Ilseman via swift-evolution > : > > > >> On Oct 17, 2017, at 10:15 AM, Kevin Nattinger via swift-evolution >> > wrote: >> >>> Because, in my analysis, the problem

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

2017-10-18 Thread Ben Cohen via swift-evolution
> On Oct 18, 2017, at 5:28 AM, Ole Begemann via swift-evolution > wrote: > > It also seems to clash with Michael's idea > > that two substitutable sequences should return true for

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

2017-10-18 Thread Xiaodi Wu via swift-evolution
On Wed, Oct 18, 2017 at 08:11 Martin R wrote: > > > > On 18. Oct 2017, at 13:55, Xiaodi Wu wrote: > > > > On Wed, Oct 18, 2017 at 03:05 Martin R wrote: > > > > > > > On 17. Oct 2017, at 23:22, Michael Ilseman via swift-evolution

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

2017-10-18 Thread Xiaodi Wu via swift-evolution
Yup. On Wed, Oct 18, 2017 at 07:28 Ole Begemann wrote: > On Tue, Oct 17, 2017, at 20:46, Xiaodi Wu via swift-evolution wrote: > > On Tue, Oct 17, 2017 at 12:54 Jonathan Hull wrote: > > Why was elementsEqual created? Isn’t it meant to check equality of two >

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

2017-10-18 Thread Martin R via swift-evolution
> On 18. Oct 2017, at 13:55, Xiaodi Wu wrote: > > On Wed, Oct 18, 2017 at 03:05 Martin R wrote: > > > > On 17. Oct 2017, at 23:22, Michael Ilseman via swift-evolution > > wrote: > > > > > > > >> On Oct 17, 2017, at 1:36

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

2017-10-18 Thread Ole Begemann via swift-evolution
On Tue, Oct 17, 2017, at 20:46, Xiaodi Wu via swift-evolution wrote: > On Tue, Oct 17, 2017 at 12:54 Jonathan Hull wrote: > >> Why was elementsEqual created? Isn’t it meant to check equality of >> two sequences in a generic context where == isn’t available?> > No no no no no no

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

2017-10-18 Thread Xiaodi Wu via swift-evolution
On Wed, Oct 18, 2017 at 03:05 Martin R wrote: > > > > On 17. Oct 2017, at 23:22, Michael Ilseman via swift-evolution < > swift-evolution@swift.org> wrote: > > > > > > > >> On Oct 17, 2017, at 1:36 PM, Benjamin G > wrote: > >> > >> > >> > >> On

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

2017-10-18 Thread Martin R via swift-evolution
> On 17. Oct 2017, at 23:22, Michael Ilseman via swift-evolution > wrote: > > > >> On Oct 17, 2017, at 1:36 PM, Benjamin G wrote: >> >> >> >> On Tue, Oct 17, 2017 at 10:25 PM, Michael Ilseman wrote: >> >>

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

2017-10-17 Thread Adam Kemp via swift-evolution
> On Oct 17, 2017, at 7:52 PM, Kevin Nattinger via swift-evolution > wrote: > > So, what I'm getting from this explanation is that `Equatable` is meaningless > on its own; each class needs to document exactly what "substitutability" > means as implemented, and

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

2017-10-17 Thread Kevin Nattinger via swift-evolution
So, what I'm getting from this explanation is that `Equatable` is meaningless on its own; each class needs to document exactly what "substitutability" means as implemented, and any code that uses `==` needs to check the documentation for that specific class and make sure the intended use

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

2017-10-17 Thread Michael Ilseman via swift-evolution
> On Oct 17, 2017, at 2:08 PM, Kevin Nattinger wrote: > >> >> On Oct 17, 2017, at 11:47 AM, Michael Ilseman > > wrote: >> >> >> >>> On Oct 17, 2017, at 10:15 AM, Kevin Nattinger via swift-evolution >>>

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

2017-10-17 Thread Xiaodi Wu via swift-evolution
On Tue, Oct 17, 2017 at 14:41 Jonathan Hull wrote: > On Oct 17, 2017, at 11:46 AM, Xiaodi Wu wrote: > > > On Tue, Oct 17, 2017 at 12:54 Jonathan Hull wrote: > >> On Oct 17, 2017, at 9:34 AM, Xiaodi Wu wrote: >> >> >> On

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

2017-10-17 Thread Michael Ilseman via swift-evolution
> On Oct 17, 2017, at 1:36 PM, Benjamin G wrote: > > > > On Tue, Oct 17, 2017 at 10:25 PM, Michael Ilseman > wrote: > > >> On Oct 17, 2017, at 12:54 PM, Benjamin G >

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

2017-10-17 Thread Kevin Nattinger via swift-evolution
> On Oct 17, 2017, at 11:47 AM, Michael Ilseman wrote: > > > >> On Oct 17, 2017, at 10:15 AM, Kevin Nattinger via swift-evolution >> > wrote: >> >>> Because, in my analysis, the problem is that the method is

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

2017-10-17 Thread Manolo van Ee via swift-evolution
If that’s an option, that could help. To me it feels like there might be something that could be fixed in the design. However, I’m not aware of all the things that were considered when creating the current design, and how much impact it will have to change it, so I can’t say too much about it and

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

2017-10-17 Thread Benjamin G via swift-evolution
On Tue, Oct 17, 2017 at 10:25 PM, Michael Ilseman wrote: > > > On Oct 17, 2017, at 12:54 PM, Benjamin G > wrote: > > Thanks for the post, that's the first clear explanation i see on this > thread for the concepts behind the design for Sequence.

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

2017-10-17 Thread Michael Ilseman via swift-evolution
(I saw this after I sent my reply to Benjamin G). We can also deprecate it or warn when the type is concretely known to be Set. Not a total solution, but it’s nice to catch some bugs. > On Oct 17, 2017, at 1:21 PM, Manolo van Ee wrote: > > > On Tue, 17 Oct 2017 at

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

2017-10-17 Thread Michael Ilseman via swift-evolution
> On Oct 17, 2017, at 12:54 PM, Benjamin G wrote: > > Thanks for the post, that's the first clear explanation i see on this thread > for the concepts behind the design for Sequence. > > I am a bit afraid that understanding all that is a bit above what to expect

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

2017-10-17 Thread Manolo van Ee via swift-evolution
On Tue, 17 Oct 2017 at 21:00, Jonathan Hull via swift-evolution < swift-evolution@swift.org> wrote: > > On Oct 17, 2017, at 11:47 AM, Michael Ilseman via swift-evolution < > swift-evolution@swift.org> wrote: > > `==` conveys substitutability of the two Sequences. This does not > necessarily

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

2017-10-17 Thread Kevin Nattinger via swift-evolution
>>> set.elementsEqual(set) >> >> I see why that would work (thanks to Set being a collection vs a sequence), >> but it still feels like a hack. I definitely wouldn’t want to be >> maintaining code with that in it. Especially when compared to something like: >> >> set.contains(where:

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

2017-10-17 Thread Adam Kemp via swift-evolution
But HashSet does implement IEnumerable, and therefore you can still call SequenceEqual on it. .Net does not distinguish between ordered and unordered enumerables. Random access is a different concept than enumerability. > On Oct 17, 2017, at 12:48 PM, Jonathan Hull via swift-evolution >

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

2017-10-17 Thread Benjamin G via swift-evolution
Thanks for the post, that's the first clear explanation i see on this thread for the concepts behind the design for Sequence. I am a bit afraid that understanding all that is a bit above what to expect the average swift developer will guess when he sees functions like "prefix / first /

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

2017-10-17 Thread Jonathan Hull via swift-evolution
Also of interest to this discussion is the following from a discussion on C#’s version of Set: > HashSet is more or less modeled after a mathematical set > , which means that: > > It may contain no duplicate values. > Its elements are in no

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

2017-10-17 Thread Jonathan Hull via swift-evolution
> On Oct 17, 2017, at 11:46 AM, Xiaodi Wu wrote: > > > On Tue, Oct 17, 2017 at 12:54 Jonathan Hull > wrote: >> On Oct 17, 2017, at 9:34 AM, Xiaodi Wu > > wrote: >> >> >> On Tue,

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

2017-10-17 Thread Jonathan Hull via swift-evolution
> On Oct 17, 2017, at 11:47 AM, Michael Ilseman via swift-evolution > wrote: > > `==` conveys substitutability of the two Sequences. This does not necessarily > entail anything about their elements, how those elements are ordered, etc., > it just means two

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

2017-10-17 Thread Michael Ilseman via swift-evolution
> On Oct 17, 2017, at 10:15 AM, Kevin Nattinger via swift-evolution > wrote: > >> Because, in my analysis, the problem is that the method is incorrectly >> named. The problem affects all types that conform to Sequence and not just >> Set and Dictionary;

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

2017-10-17 Thread Xiaodi Wu via swift-evolution
On Tue, Oct 17, 2017 at 12:54 Jonathan Hull wrote: > On Oct 17, 2017, at 9:34 AM, Xiaodi Wu wrote: > > > On Tue, Oct 17, 2017 at 09:42 Jonathan Hull wrote: > >> On Oct 17, 2017, at 5:44 AM, Xiaodi Wu wrote: >> >> >> On

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

2017-10-17 Thread Adam Kemp via swift-evolution
> On Oct 17, 2017, at 11:20 AM, Kevin Nattinger wrote: > > Hmm, I'm not sure that would work with the covariant requirement. The > associated type one could: > func firstNames(ofPeople people: U) -> > U.MapResultType { > return people.map { $0.firstName } > } > >

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

2017-10-17 Thread Adam Kemp via swift-evolution
> On Oct 17, 2017, at 10:41 AM, Kevin Nattinger via swift-evolution > wrote: > >> On Oct 17, 2017, at 10:36 AM, Adam Kemp > > wrote: >> >> >>> On Oct 17, 2017, at 10:00 AM, Kevin Nattinger

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

2017-10-17 Thread Jonathan Hull via swift-evolution
> On Oct 17, 2017, at 9:34 AM, Xiaodi Wu wrote: > > > On Tue, Oct 17, 2017 at 09:42 Jonathan Hull > wrote: >> On Oct 17, 2017, at 5:44 AM, Xiaodi Wu > > wrote: >> >> >> On Tue,

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

2017-10-17 Thread Kevin Nattinger via swift-evolution
> On Oct 17, 2017, at 10:36 AM, Adam Kemp wrote: > > >> On Oct 17, 2017, at 10:00 AM, Kevin Nattinger > > wrote: >> >> Once we allow covariant functions to satisfy protocol requirements and have >> generalized

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

2017-10-17 Thread Adam Kemp via swift-evolution
> On Oct 17, 2017, at 10:00 AM, Kevin Nattinger wrote: > > Once we allow covariant functions to satisfy protocol requirements and have > generalized existentials and recursive protocol requirements, wouldn't we be > able to update thusly: > > protocol Unordered { >

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

2017-10-17 Thread David Sweeris via swift-evolution
> On Oct 17, 2017, at 9:34 AM, Xiaodi Wu via swift-evolution > wrote: > > > On Tue, Oct 17, 2017 at 09:42 Jonathan Hull > wrote: >> On Oct 17, 2017, at 5:44 AM, Xiaodi Wu >

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

2017-10-17 Thread Kevin Nattinger via swift-evolution
> On Oct 16, 2017, at 1:29 PM, Adam Kemp via swift-evolution > wrote: > > > >> On Oct 16, 2017, at 12:35 PM, Thorsten Seitz via swift-evolution >> > wrote: >> >> IMHO `elementsEqual` provides a nice

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

2017-10-17 Thread Kevin Nattinger via swift-evolution
> Because, in my analysis, the problem is that the method is incorrectly named. > The problem affects all types that conform to Sequence and not just Set and > Dictionary; elementsEqual is a distinct function from ==, and it must either > continue to be distinct or cease to exist, but its name

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

2017-10-17 Thread Adam Kemp via swift-evolution
> On Oct 16, 2017, at 11:06 PM, Thorsten Seitz 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

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

2017-10-17 Thread Xiaodi Wu via swift-evolution
On Tue, Oct 17, 2017 at 11:01 Thorsten Seitz wrote: > > > Am 17.10.2017 um 14:46 schrieb Xiaodi Wu : > > On Tue, Oct 17, 2017 at 01:03 Thorsten Seitz wrote: > >> >> >> Am 17.10.2017 um 01:43 schrieb Xiaodi Wu via swift-evolution <

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

2017-10-17 Thread Xiaodi Wu via swift-evolution
On Tue, Oct 17, 2017 at 09:42 Jonathan Hull wrote: > On Oct 17, 2017, at 5:44 AM, Xiaodi Wu wrote: > > > On Tue, Oct 17, 2017 at 00:56 Thorsten Seitz wrote: > >> >> >> Am 17.10.2017 um 00:13 schrieb Xiaodi Wu : >>

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

2017-10-17 Thread Thorsten Seitz via swift-evolution
> Am 17.10.2017 um 14:46 schrieb Xiaodi Wu : > >> On Tue, Oct 17, 2017 at 01:03 Thorsten Seitz wrote: >> >> >>> Am 17.10.2017 um 01:43 schrieb Xiaodi Wu via swift-evolution >>> : >>> On Mon, Oct 16, 2017 at 6:10 PM,

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

2017-10-17 Thread Thorsten Seitz via swift-evolution
> Am 17.10.2017 um 14:44 schrieb Xiaodi Wu : > > >> On Tue, Oct 17, 2017 at 00:56 Thorsten Seitz wrote: >> >> >>> Am 17.10.2017 um 00:13 schrieb Xiaodi Wu : >>> >>> >>> On Mon, Oct 16, 2017 at 14:21 Thorsten Seitz

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

2017-10-17 Thread Thorsten Seitz via swift-evolution
Hi Gwendal, these are use cases for using indices as unordered references which certainly are useful. I was looking for use cases depending on the order exposed by Sequence, specifically use cases for elementsEqual. -Thorsten > Am 17.10.2017 um 09:03 schrieb Gwendal Roué

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

2017-10-17 Thread Jonathan Hull via swift-evolution
> On Oct 17, 2017, at 5:44 AM, Xiaodi Wu wrote: > > > On Tue, Oct 17, 2017 at 00:56 Thorsten Seitz > wrote: > > > Am 17.10.2017 um 00:13 schrieb Xiaodi Wu >: > >> >>

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

2017-10-17 Thread Xiaodi Wu via swift-evolution
On Tue, Oct 17, 2017 at 01:24 Thorsten Seitz wrote: > > > Am 17.10.2017 um 03:20 schrieb Xiaodi Wu via swift-evolution < > swift-evolution@swift.org>: > > On Mon, Oct 16, 2017 at 8:03 PM, David Sweeris > wrote: > >> >> On Oct 16, 2017, at 1:07 PM,

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

2017-10-17 Thread Xiaodi Wu via swift-evolution
On Tue, Oct 17, 2017 at 01:03 Thorsten Seitz wrote: > > > Am 17.10.2017 um 01:43 schrieb Xiaodi Wu via swift-evolution < > swift-evolution@swift.org>: > > On Mon, Oct 16, 2017 at 6:10 PM, Jonathan Hull wrote: > >> >> On Oct 16, 2017, at 1:05 PM, Xiaodi Wu

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

2017-10-17 Thread Xiaodi Wu via swift-evolution
On Tue, Oct 17, 2017 at 00:56 Thorsten Seitz wrote: > > > Am 17.10.2017 um 00:13 schrieb Xiaodi Wu : > > > On Mon, Oct 16, 2017 at 14:21 Thorsten Seitz wrote: > >> Am 16.10.2017 um 16:20 schrieb Xiaodi Wu via swift-evolution < >>

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

2017-10-17 Thread Martin R via swift-evolution
> On 17. Oct 2017, at 09:48, Jonathan Hull via swift-evolution > wrote: > > >> On Oct 17, 2017, at 12:04 AM, Gwendal Roué via swift-evolution >> wrote: >> Modeling is, by definition, imperfect. The question is, what imperfect

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

2017-10-17 Thread Jonathan Hull via swift-evolution
> On Oct 17, 2017, at 12:04 AM, Gwendal Roué via swift-evolution > wrote: > >>> Modeling is, by definition, imperfect. The question is, what imperfect >>> model is most useful _to Swift_. The idea is that conforming Set and >>> Dictionary to Collection is on

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

2017-10-17 Thread Gwendal Roué via swift-evolution
Oops, I apologize for the buggy implementation of the Collection.anyElement(notEqualTo:) method I did provide. My point was just to show that there are useful generic algorithms that can use the observable ordering of sets and dictionaries, despite the fact that those ordering can not be

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

2017-10-17 Thread Gwendal Roué via swift-evolution
>> Modeling is, by definition, imperfect. The question is, what imperfect model >> is most useful _to Swift_. The idea is that conforming Set and Dictionary to >> Collection is on balance more useful than not doing so; that having two >> protocols, Sequence and Collection, is on balance more

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

2017-10-17 Thread Thorsten Seitz via swift-evolution
> Am 17.10.2017 um 03:20 schrieb Xiaodi Wu via swift-evolution > : > >> On Mon, Oct 16, 2017 at 8:03 PM, David Sweeris wrote: >> >>> On Oct 16, 2017, at 1:07 PM, Xiaodi Wu wrote: >>> >>> On Mon, Oct 16, 2017 at

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

2017-10-17 Thread Thorsten Seitz via swift-evolution
> Am 17.10.2017 um 00:15 schrieb Adam Kemp : > > >>> On Oct 16, 2017, at 3:08 PM, Thorsten Seitz wrote: >>> >>> 2. It’s generally useful to be able to ask if two objects that you can >>> iterate over are equal by comparing the elements in the order

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

2017-10-17 Thread Thorsten Seitz via swift-evolution
> Am 17.10.2017 um 01:43 schrieb Xiaodi Wu via swift-evolution > : > >> On Mon, Oct 16, 2017 at 6:10 PM, Jonathan Hull wrote: >> >>> On Oct 16, 2017, at 1:05 PM, Xiaodi Wu wrote: >>> >>> On Mon, Oct 16, 2017 at 10:49

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

2017-10-17 Thread Thorsten Seitz via swift-evolution
Even worse, Set([5,4,3,2,1]) will probably return false although it contains the same elements. -Thorsten > Am 17.10.2017 um 01:40 schrieb Jonathan Hull via swift-evolution > : > > To expand on this, Set([1,2,3,4,5]).hasPrefix([1,2,3]) currently returns > true.

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

2017-10-16 Thread Xiaodi Wu via swift-evolution
On Mon, Oct 16, 2017 at 8:03 PM, David Sweeris wrote: > > On Oct 16, 2017, at 1:07 PM, Xiaodi Wu wrote: > > > On Mon, Oct 16, 2017 at 13:15 David Sweeris wrote: > >> >> On Oct 16, 2017, at 09:21, Michael Ilseman

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

2017-10-16 Thread David Sweeris via swift-evolution
> On Oct 16, 2017, at 1:07 PM, Xiaodi Wu wrote: > > > On Mon, Oct 16, 2017 at 13:15 David Sweeris > wrote: > > On Oct 16, 2017, at 09:21, Michael Ilseman > wrote: > >>

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

2017-10-16 Thread Howard Lovatt via swift-evolution
My preferences in order would be: 1. Split out of Sequence Iterable/ForEachable (whatever the name) and have Set and Dictionary conform to this new protocol instead of Sequence. With further protocols splits made to other 'mixin' protocols to keep the order of iteration undefined. 2. Rename

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

2017-10-16 Thread Xiaodi Wu via swift-evolution
On Mon, Oct 16, 2017 at 6:40 PM, Jonathan Hull wrote: > To expand on this, Set([1,2,3,4,5]).hasPrefix([1,2,3]) currently returns > true. But let’s say a year from now, we change Set to return an ordering > based on hash values (which is entirely reasonable). Suddenly the same

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

2017-10-16 Thread Xiaodi Wu via swift-evolution
On Mon, Oct 16, 2017 at 6:10 PM, Jonathan Hull wrote: > > On Oct 16, 2017, at 1:05 PM, Xiaodi Wu wrote: > > > On Mon, Oct 16, 2017 at 10:49 Jonathan Hull wrote: > >> >> On Oct 16, 2017, at 7:20 AM, Xiaodi Wu wrote: >>

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

2017-10-16 Thread Jonathan Hull via swift-evolution
To expand on this, Set([1,2,3,4,5]).hasPrefix([1,2,3]) currently returns true. But let’s say a year from now, we change Set to return an ordering based on hash values (which is entirely reasonable). Suddenly the same code may return true or false. No guarantees will be broken by doing that,

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

2017-10-16 Thread Jonathan Hull via swift-evolution
> On Oct 16, 2017, at 1:05 PM, Xiaodi Wu wrote: > > > On Mon, Oct 16, 2017 at 10:49 Jonathan Hull > wrote: > >> On Oct 16, 2017, at 7:20 AM, Xiaodi Wu > > wrote: >> >> To start

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

2017-10-16 Thread Xiaodi Wu via swift-evolution
On Mon, Oct 16, 2017 at 15:31 Greg Parker wrote: > On Oct 16, 2017, at 1:08 PM, Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > > On Mon, Oct 16, 2017 at 13:15 David Sweeris wrote: > > >> On Oct 16, 2017, at 09:21, Michael Ilseman

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

2017-10-16 Thread Adam Kemp via swift-evolution
> On Oct 16, 2017, at 3:08 PM, Thorsten Seitz wrote: > >> 2. It’s generally useful to be able to ask if two objects that you can >> iterate over are equal by comparing the elements in the order that they’re >> iterated over. > > Here I disagree. This operation only makes

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

2017-10-16 Thread Xiaodi Wu via swift-evolution
On Mon, Oct 16, 2017 at 14:21 Thorsten Seitz wrote: > Am 16.10.2017 um 16:20 schrieb Xiaodi Wu via swift-evolution < > swift-evolution@swift.org>: > > > On Mon, Oct 16, 2017 at 05:48 Jonathan Hull wrote: > >> >> On Oct 15, 2017, at 9:58 PM, Xiaodi Wu

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

2017-10-16 Thread Thorsten Seitz via swift-evolution
> Am 16.10.2017 um 22:29 schrieb Adam Kemp : > > > >> On Oct 16, 2017, at 12:35 PM, Thorsten Seitz via swift-evolution >> > wrote: >> >> IMHO `elementsEqual` provides a nice example for a method which only

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

2017-10-16 Thread Greg Parker via swift-evolution
> On Oct 16, 2017, at 1:08 PM, Xiaodi Wu via swift-evolution > wrote: > > On Mon, Oct 16, 2017 at 13:15 David Sweeris > wrote: > > On Oct 16, 2017, at 09:21, Michael Ilseman

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

2017-10-16 Thread Adam Kemp via swift-evolution
> On Oct 16, 2017, at 12:35 PM, Thorsten Seitz via swift-evolution > wrote: > > IMHO `elementsEqual` provides a nice example for a method which only makes > sense on something meaningfully ordered: > What is the use case for `elementsEqual` that works with a Set?

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

2017-10-16 Thread Kevin Nattinger via swift-evolution
> On Oct 16, 2017, at 1:08 PM, Xiaodi Wu via swift-evolution > wrote: > > > On Mon, Oct 16, 2017 at 13:15 David Sweeris > wrote: > > On Oct 16, 2017, at 09:21, Michael Ilseman

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

2017-10-16 Thread Xiaodi Wu via swift-evolution
On Mon, Oct 16, 2017 at 13:15 David Sweeris wrote: > > On Oct 16, 2017, at 09:21, Michael Ilseman wrote: > > > > On Oct 16, 2017, at 8:46 AM, David Sweeris via swift-evolution < > swift-evolution@swift.org> wrote: > > > On Oct 16, 2017, at 07:20, Xiaodi

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

2017-10-16 Thread Xiaodi Wu via swift-evolution
On Mon, Oct 16, 2017 at 10:49 Jonathan Hull wrote: > > On Oct 16, 2017, at 7:20 AM, Xiaodi Wu 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 >>

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

2017-10-16 Thread Xiaodi Wu via swift-evolution
On Mon, Oct 16, 2017 at 14:55 Kevin Nattinger via swift-evolution < swift-evolution@swift.org> wrote: > On Oct 16, 2017, at 11:23 AM, David Sweeris via swift-evolution < > swift-evolution@swift.org> wrote: > > > On Oct 16, 2017, at 10:42, BJ Homer via swift-evolution < >

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

2017-10-16 Thread Kevin Nattinger via swift-evolution
> On Oct 16, 2017, at 11:23 AM, David Sweeris via swift-evolution > wrote: > > > On Oct 16, 2017, at 10:42, BJ Homer via swift-evolution > > wrote: > >>> On Oct 16, 2017, at 8:20 AM, Thorsten Seitz via

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

2017-10-16 Thread Thorsten Seitz via swift-evolution
> Am 16.10.2017 um 19:42 schrieb BJ Homer : > >> On Oct 16, 2017, at 8:20 AM, Thorsten Seitz via swift-evolution >> > wrote: >> >>> Am 16.10.2017 um 07:19 schrieb Xiaodi Wu >>

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

2017-10-16 Thread Thorsten Seitz via swift-evolution
> Am 16.10.2017 um 18:19 schrieb Michael Ilseman : > > > >> On Oct 16, 2017, at 7:20 AM, Thorsten Seitz via swift-evolution >> > wrote: >> >> >> >> Am 16.10.2017 um 07:19 schrieb Xiaodi Wu

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

2017-10-16 Thread Thorsten Seitz via swift-evolution
> Am 16.10.2017 um 17:49 schrieb Jonathan Hull via swift-evolution > : > > >> On Oct 16, 2017, at 7:20 AM, Xiaodi Wu > > wrote: >> >> To start with, the one you gave as an example at the beginning of this >>

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

2017-10-16 Thread Thorsten Seitz via swift-evolution
> Am 16.10.2017 um 16:20 schrieb Xiaodi Wu via swift-evolution > : > > > On Mon, Oct 16, 2017 at 05:48 Jonathan Hull > wrote: > >> On Oct 15, 2017, at 9:58 PM, Xiaodi Wu > >

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

2017-10-16 Thread Kevin Nattinger via swift-evolution
> On Oct 16, 2017, at 10:43 AM, BJ Homer via swift-evolution > wrote: > >> On Oct 16, 2017, at 8:20 AM, Thorsten Seitz via swift-evolution >> > wrote: >> >>> Am 16.10.2017 um 07:19 schrieb Xiaodi Wu

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

2017-10-16 Thread Michael Ilseman via swift-evolution
A Set has indices because they are useful to use with the type. Regardless of whether Set conforms to Collection, or even Sequence, indices are useful and meaningful for Sets. Even if the entire protocol hierarchy were to be redesigned, Set would provide indices. If Set didn’t implement any

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

2017-10-16 Thread Michael Ilseman via swift-evolution
Sets being values are not an implementation detail. They have value semantics, and that is part of the guarantee of the type. This is perhaps the most important concept in the standard library. > On Oct 16, 2017, at 10:27 AM, Kevin Nattinger wrote: > >>> >>> How is the

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

2017-10-16 Thread David Sweeris via swift-evolution
> On Oct 16, 2017, at 10:42, BJ Homer via swift-evolution > wrote: > >>> On Oct 16, 2017, at 8:20 AM, Thorsten Seitz via swift-evolution >>> wrote: >>> >>> Am 16.10.2017 um 07:19 schrieb Xiaodi Wu : >> >>> What

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

2017-10-16 Thread David Sweeris via swift-evolution
> On Oct 16, 2017, at 09:21, Michael Ilseman wrote: > > > >> On Oct 16, 2017, at 8:46 AM, David Sweeris via swift-evolution >> wrote: >> >> >> On Oct 16, 2017, at 07:20, Xiaodi Wu via swift-evolution >> wrote: >>

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

2017-10-16 Thread BJ Homer via swift-evolution
> On Oct 16, 2017, at 8:20 AM, Thorsten Seitz via swift-evolution > wrote: > >> Am 16.10.2017 um 07:19 schrieb Xiaodi Wu > >: > >> What useful generic algorithms would this protocol support that are not >> already

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

2017-10-16 Thread Kevin Nattinger via swift-evolution
>> >> How is the iteration order of an unordered set or dictionary “publicly >> observable”? If either is implemented such that it can asynchronously >> optimize its storage (maybe by rebalancing a tree or merging two >> non-contiguous array segments or something), its iteration order could

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

2017-10-16 Thread Kevin Nattinger via swift-evolution
>> […] >> Set conforming to Collection is even worse than just conforming to Sequence >> as a quote from the documentation shows: "In addition to the operations that >> collections inherit from the Sequence protocol, you gain access to methods >> that depend on accessing an element at a

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

2017-10-16 Thread Michael Ilseman via swift-evolution
> On Oct 16, 2017, at 8:46 AM, David Sweeris via swift-evolution > wrote: > > > On Oct 16, 2017, at 07:20, Xiaodi Wu via swift-evolution > > wrote: > >> >> On Mon, Oct 16, 2017 at 05:48 Jonathan Hull

  1   2   >