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 specific

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 > mailto:swift-evolution@swift.org>> wrote: > >> >> On Mon, Oct 16, 2017 at 05:48 Jonathan Hull > > wrote: >> >>> On Oct 15, 2017

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

2017-10-16 Thread Michael Ilseman via swift-evolution
> On Oct 16, 2017, at 7:20 AM, Thorsten Seitz via swift-evolution > wrote: > > > > Am 16.10.2017 um 07:19 schrieb Xiaodi Wu >: > >> On Sun, Oct 15, 2017 at 11:57 PM, Thorsten Seitz > > wrote: >> >> >> Am 16.10.2017 um 00:41 schrieb

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

2017-10-16 Thread 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 > discussion: Two sets with identical elements which have different internal > storage and thus give different orderings as sequences. You yourself have > argued that th

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

2017-10-16 Thread David Sweeris via swift-evolution
> On Oct 16, 2017, at 07:20, Xiaodi Wu via swift-evolution > wrote: > > >> On Mon, Oct 16, 2017 at 05:48 Jonathan Hull wrote: >> >>> On Oct 15, 2017, at 9:58 PM, Xiaodi Wu wrote: >>> On Sun, Oct 15, 2017 at 8:51 PM, Jonathan Hull wrote: >> On Oct 14, 2017, at 10:48 PM, Xiao

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

2017-10-16 Thread 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 wrote: > > On Sun, Oct 15, 2017 at 8:51 PM, Jonathan Hull wrote: > >> >> On Oct 14, 2017, at 10:48 PM, Xiaodi Wu wrote: >> >>> That ordering can be arbitrary, but it shouldn’t leak internal repr

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

2017-10-16 Thread Thorsten Seitz via swift-evolution
>> Am 16.10.2017 um 07:19 schrieb Xiaodi Wu : >> >> On Sun, Oct 15, 2017 at 11:57 PM, Thorsten Seitz wrote: >> >> >>> Am 16.10.2017 um 00:41 schrieb Xiaodi Wu via swift-evolution >>> : >>> >>> On Sun, Oct 15, 2017 at 2:32 PM, Kevin Nattinger >>> wrote: > […] > Sets, as a mathemati

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

2017-10-16 Thread Jonathan Hull via swift-evolution
> On Oct 15, 2017, at 9:58 PM, Xiaodi Wu wrote: > > On Sun, Oct 15, 2017 at 8:51 PM, Jonathan Hull > wrote: > >> On Oct 14, 2017, at 10:48 PM, Xiaodi Wu > > wrote: That ordering can be arbitrary, but it shouldn’t leak internal repr

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

2017-10-16 Thread Benjamin Garrigues via swift-evolution
> Le 16 oct. 2017 à 07:20, Xiaodi Wu via swift-evolution > a écrit : > >> On Sun, Oct 15, 2017 at 11:57 PM, Thorsten Seitz wrote: >> >> >>> Am 16.10.2017 um 00:41 schrieb Xiaodi Wu via swift-evolution >>> : >>> >>> On Sun, Oct 15, 2017 at 2:32 PM, Kevin Nattinger >>> wrote: > […] >>

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

2017-10-15 Thread Adam Kemp via swift-evolution
FWIW, in .Net the equivalent of Sequence is IEnumerable, and the equivalent of IteratorProtocol is IEnumerator. In .Net there are extension methods for IEnumerable for things like First, Last, and SequenceEqual. Like Swift’s Sequence, .Net’s IEnumerable makes no promises about the order of itera

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

2017-10-15 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 11:59 PM, Thorsten Seitz wrote: > > > Am 16.10.2017 um 00:46 schrieb Xiaodi Wu : > > On Sun, Oct 15, 2017 at 2:39 PM, Kevin Nattinger > wrote: > >> […] >> Swift's Sequence protocol does not require the order of iteration to >> "convey any meaning"; it doesn't even require

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

2017-10-15 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 11:57 PM, Thorsten Seitz wrote: > > > Am 16.10.2017 um 00:41 schrieb Xiaodi Wu via swift-evolution < > swift-evolution@swift.org>: > > On Sun, Oct 15, 2017 at 2:32 PM, Kevin Nattinger > wrote: > >> […] >> Sets, as a mathematical concept, have no intrinsic order. However,

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

2017-10-15 Thread Thorsten Seitz via swift-evolution
> Am 16.10.2017 um 04:36 schrieb Jonathan Hull via swift-evolution > : > > Ok, just to summarize our options so far (in order of effort & theoretical > effectiveness): > > 1) Do nothing - This is the easiest thing to do, but it won’t fix any problems > > 2) Rename the elementsEqual method: (

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

2017-10-15 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 9:36 PM, Jonathan Hull wrote: > Ok, just to summarize our options so far (in order of effort & theoretical > effectiveness): > > 1) *Do nothing* - This is the easiest thing to do, but it won’t fix any > problems > > 2) *Rename the elementsEqual method*: (Again, fairly easy

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

2017-10-15 Thread Thorsten Seitz via swift-evolution
> Am 16.10.2017 um 00:46 schrieb Xiaodi Wu : > > On Sun, Oct 15, 2017 at 2:39 PM, Kevin Nattinger wrote: >>> […] >>> Swift's Sequence protocol does not require the order of iteration to >>> "convey any meaning"; it doesn't even require it to be deterministic. >>> >> >> And that’s EXACTLY why

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

2017-10-15 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 8:51 PM, Jonathan Hull wrote: > > On Oct 14, 2017, at 10:48 PM, Xiaodi Wu wrote: > >> That ordering can be arbitrary, but it shouldn’t leak internal >>> representation such that the method used to create identical things affects >>> the outcome of generic methods because

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

2017-10-15 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 8:35 PM, Jonathan Hull wrote: > > On Oct 15, 2017, at 3:41 PM, Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > > I’ll have to mull this over to see if I can come up with a coherent and >> (more) specific requirement for what makes an Iterable a Sequen

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

2017-10-15 Thread Thorsten Seitz via swift-evolution
> Am 16.10.2017 um 00:41 schrieb Xiaodi Wu via swift-evolution > : > > On Sun, Oct 15, 2017 at 2:32 PM, Kevin Nattinger wrote: >>> […] >>> Sets, as a mathematical concept, have no intrinsic order. However, >>> instances of `Set`, which can be iterated over, *do* have at least one >>> order w

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

2017-10-15 Thread Thorsten Seitz via swift-evolution
> Am 15.10.2017 um 21:22 schrieb Xiaodi Wu : > > > On Sun, Oct 15, 2017 at 14:14 Thorsten Seitz wrote: >>> Am 15.10.2017 um 10:38 schrieb Xiaodi Wu via swift-evolution >>> : >>> On Sun, Oct 15, 2017 at 2:29 AM, Kevin Nattinger wrote: > On Oct 14, 2017, at 7:54 PM, Xiaod

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

2017-10-15 Thread Jonathan Hull via swift-evolution
Ok, just to summarize our options so far (in order of effort & theoretical effectiveness): 1) Do nothing - This is the easiest thing to do, but it won’t fix any problems 2) Rename the elementsEqual method: (Again, fairly easy to do, and will hopefully reduce confusion, but doesn’t fix the under

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

2017-10-15 Thread Jonathan Hull via swift-evolution
> On Oct 14, 2017, at 10:48 PM, Xiaodi Wu wrote: >>> That ordering can be arbitrary, but it shouldn’t leak internal >>> representation such that the method used to create identical things affects >>> the outcome of generic methods because of differences in internal >>> representation. >>> >>

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

2017-10-15 Thread Jonathan Hull via swift-evolution
> On Oct 15, 2017, at 3:41 PM, Xiaodi Wu via swift-evolution > wrote: > > I’ll have to mull this over to see if I can come up with a coherent and > (more) specific requirement for what makes an Iterable a Sequence, since > clearly “documented” isn’t enough. Perhaps something along the lines

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

2017-10-15 Thread Jose Cheyo Jimenez via swift-evolution
> On Oct 14, 2017, at 6:11 PM, Michael Ilseman via swift-evolution > wrote: > > I think that “match” is a word to avoid for this, as this doesn’t have > anything to do with pattern matching, fuzzy matching, etc., while “equals” > is precisely the concept we’re using. > > What about the name

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

2017-10-15 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 2:39 PM, Kevin Nattinger wrote: > […] > Swift's Sequence protocol does not require the order of iteration to > "convey any meaning"; it doesn't even require it to be deterministic. > > > And that’s EXACTLY why none of the functions on Sequence should rely on > the order co

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

2017-10-15 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 2:32 PM, Kevin Nattinger wrote: > […] > Sets, as a mathematical concept, have no intrinsic order. However, > instances of `Set`, which can be iterated over, *do* have at least one > order which can be said to be intrinsic in the following sense: as long as > iteration is p

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

2017-10-15 Thread Michael Ilseman via swift-evolution
That is what == does: https://github.com/apple/swift/blob/master/stdlib/public/core/HashedCollections.swift.gyb#L1267 > On Oct 15, 2017, at 1:25 PM, C. Keith Ray via swift-evolution > wrote: > > Why not use an equals Implementation that doesn't rely on order? > > Something like this (which do

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

2017-10-15 Thread C. Keith Ray via swift-evolution
Why not use an equals Implementation that doesn't rely on order? Something like this (which doesn't compile in my iPad playground). If two sets have the same number of elements, and every element in one can be found in the other, they are equal, otherwise they are not equal. protocol Set {

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

2017-10-15 Thread Kevin Nattinger via swift-evolution
> […] > Swift's Sequence protocol does not require the order of iteration to "convey > any meaning"; it doesn't even require it to be deterministic. > And that’s EXACTLY why none of the functions on Sequence should rely on the order conveying meaning. `ElementsEqual` (for example) DOES rely on

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

2017-10-15 Thread Kevin Nattinger via swift-evolution
> […] > Sets, as a mathematical concept, have no intrinsic order. However, instances > of `Set`, which can be iterated over, *do* have at least one order which can > be said to be intrinsic in the following sense: as long as iteration is > possible, no API design can prevent that order from bein

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

2017-10-15 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 14:14 Thorsten Seitz wrote: > Am 15.10.2017 um 10:38 schrieb Xiaodi Wu via swift-evolution < > swift-evolution@swift.org>: > > On Sun, Oct 15, 2017 at 2:29 AM, Kevin Nattinger > wrote: > >> >> On Oct 14, 2017, at 7:54 PM, Xiaodi Wu wrote: >> >> On Sat, Oct 14, 2017 at 6:

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

2017-10-15 Thread Thorsten Seitz via swift-evolution
> Am 15.10.2017 um 10:38 schrieb Xiaodi Wu via swift-evolution > : > > On Sun, Oct 15, 2017 at 2:29 AM, Kevin Nattinger > wrote: > >> On Oct 14, 2017, at 7:54 PM, Xiaodi Wu > > wrote: >> >> On Sat, Oct 14, 2017 at 6:17 PM, Kevin Nattinge

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

2017-10-15 Thread Benjamin G via swift-evolution
On Sat, Oct 14, 2017 at 3:45 AM, Brent Royal-Gordon via swift-evolution < swift-evolution@swift.org> wrote: > > On Oct 12, 2017, at 9:57 PM, Kevin Nattinger via swift-evolution < > swift-evolution@swift.org> wrote: > > > > That is reflected in the fact that over half the methods in the main > Sequ

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

2017-10-15 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 2:29 AM, Kevin Nattinger wrote: > > On Oct 14, 2017, at 7:54 PM, Xiaodi Wu wrote: > > On Sat, Oct 14, 2017 at 6:17 PM, Kevin Nattinger > wrote: > >> […] >>> * A Swift `Sequence` is, to put it simplistically, a thing that can be >>> iterated over in a `for...in` loop. If

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

2017-10-15 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 2:39 AM, Adam Kemp wrote: > > > > On Oct 15, 2017, at 12:26 AM, Xiaodi Wu wrote: > > > > Hmm, I do think I can squash some of these suggestions into an explicit > and very clear option: > > > > equalsInIterationOrder(_:) > > I could live with that name. > > > > > We would

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

2017-10-15 Thread Adam Kemp via swift-evolution
> On Oct 15, 2017, at 12:26 AM, Xiaodi Wu wrote: > > Hmm, I do think I can squash some of these suggestions into an explicit and > very clear option: > > equalsInIterationOrder(_:) I could live with that name. > > We would then clarify the corresponding precedence function in the same way

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

2017-10-15 Thread Kevin Nattinger via swift-evolution
> On Oct 14, 2017, at 7:54 PM, Xiaodi Wu wrote: > > On Sat, Oct 14, 2017 at 6:17 PM, Kevin Nattinger > wrote: >>> […] >>> * A Swift `Sequence` is, to put it simplistically, a thing that can be >>> iterated over in a `for...in` loop. If it would make you happy, for t

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

2017-10-15 Thread Adam Kemp via swift-evolution
I don’t think it’s impossible. I still think pairwiseEqual is clear and intuitive, and if sequenceEqual doesn’t work because of other conventions then maybe sequentiallyEqual could work. There have been several other proposed names as well. We should be spending more time discussing these altern

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

2017-10-15 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 1:18 AM, Xiaodi Wu wrote: > On Sun, Oct 15, 2017 at 12:56 AM, Adam Kemp wrote: > >> >> >> > On Oct 14, 2017, at 10:32 PM, Xiaodi Wu wrote: >> > >> > Therefore, it is entirely OK (to me) if the result is something that is >> so obtuse as to be at first meaningless to most

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

2017-10-14 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 12:56 AM, Adam Kemp wrote: > > > > On Oct 14, 2017, at 10:32 PM, Xiaodi Wu wrote: > > > > Therefore, it is entirely OK (to me) if the result is something that is > so obtuse as to be at first meaningless to most people. > > I can’t speak for others, but it’s not ok with m

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

2017-10-14 Thread Adam Kemp via swift-evolution
> On Oct 14, 2017, at 10:32 PM, Xiaodi Wu wrote: > > Therefore, it is entirely OK (to me) if the result is something that is so > obtuse as to be at first meaningless to most people. I can’t speak for others, but it’s not ok with me. API is UX. It should be understandable and approachable. I

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

2017-10-14 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 12:33 AM, Jonathan Hull wrote: > > On Oct 14, 2017, at 9:59 PM, Xiaodi Wu wrote: > > On Sat, Oct 14, 2017 at 11:48 PM, Jonathan Hull wrote: > >> >> On Oct 14, 2017, at 9:21 PM, Xiaodi Wu wrote: >> >> On Sat, Oct 14, 2017 at 10:55 PM, Jonathan Hull wrote: >> >>> >>> On

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

2017-10-14 Thread Jonathan Hull via swift-evolution
> On Oct 14, 2017, at 9:59 PM, Xiaodi Wu wrote: > > On Sat, Oct 14, 2017 at 11:48 PM, Jonathan Hull > wrote: > >> On Oct 14, 2017, at 9:21 PM, Xiaodi Wu > > wrote: >> >> On Sat, Oct 14, 2017 at 10:55 PM, Jonathan Hull >

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

2017-10-14 Thread Xiaodi Wu via swift-evolution
On Sun, Oct 15, 2017 at 12:18 AM, Adam Kemp wrote: > The fact is, no matter how much it surprises and bothers you, there is > clear evidence from the reactions in this thread that the proposed name is > not as clear as you think it is. It doesn’t matter why. > Disagree strongly that it doesn't m

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

2017-10-14 Thread Adam Kemp via swift-evolution
The fact is, no matter how much it surprises and bothers you, there is clear evidence from the reactions in this thread that the proposed name is not as clear as you think it is. It doesn’t matter why. This thread could be more productive if you would consider the various other proposed names wi

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

2017-10-14 Thread Xiaodi Wu via swift-evolution
On Sat, Oct 14, 2017 at 11:48 PM, Jonathan Hull wrote: > > On Oct 14, 2017, at 9:21 PM, Xiaodi Wu wrote: > > On Sat, Oct 14, 2017 at 10:55 PM, Jonathan Hull wrote: > >> >> On Oct 14, 2017, at 7:55 PM, Xiaodi Wu via swift-evolution < >> swift-evolution@swift.org> wrote: >> >> > Ordered, yes, but

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

2017-10-14 Thread Xiaodi Wu via swift-evolution
On Sat, Oct 14, 2017 at 11:25 PM, Jonathan Hull wrote: > Because the mathematical term you talk about has conditions which must be > met to be used/valid. Namely: > > 1) The “Alphabet” of elements must be totally ordered > 2) The lexicographical comparison must be applied to ordered sequences of

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

2017-10-14 Thread Jonathan Hull via swift-evolution
> On Oct 14, 2017, at 9:21 PM, Xiaodi Wu wrote: > > On Sat, Oct 14, 2017 at 10:55 PM, Jonathan Hull > wrote: > >> On Oct 14, 2017, at 7:55 PM, Xiaodi Wu via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> > Ordered, yes, but it’s only admittedly poor

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

2017-10-14 Thread Jonathan Hull via swift-evolution
Because the mathematical term you talk about has conditions which must be met to be used/valid. Namely: 1) The “Alphabet” of elements must be totally ordered 2) The lexicographical comparison must be applied to ordered sequences of elements from that alphabet Neither of those conditions are me

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

2017-10-14 Thread Xiaodi Wu via swift-evolution
On Sat, Oct 14, 2017 at 10:55 PM, Jonathan Hull wrote: > > On Oct 14, 2017, at 7:55 PM, Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > > > Ordered, yes, but it’s only admittedly poor wording that suggests > multi-pass, and I don’t think anything there suggests finite. > > I

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

2017-10-14 Thread Jonathan Hull via swift-evolution
> On Oct 14, 2017, at 7:55 PM, Xiaodi Wu via swift-evolution > wrote: > > > Ordered, yes, but it’s only admittedly poor wording that suggests > > multi-pass, and I don’t think anything there suggests finite. > > If a Sequence is "guaranteed to iterate the same every time," then surely it > m

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

2017-10-14 Thread Xiaodi Wu via swift-evolution
On Sat, Oct 14, 2017 at 8:11 PM, Michael Ilseman wrote: > I think that “match” is a word to avoid for this, as this doesn’t have > anything to do with pattern matching, fuzzy matching, etc., while “equals” > is precisely the concept we’re using. > > What about the name “sequentiallyEquals”? High

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

2017-10-14 Thread Xiaodi Wu via swift-evolution
On Sat, Oct 14, 2017 at 6:17 PM, Kevin Nattinger wrote: > […] >> * A Swift `Sequence` is, to put it simplistically, a thing that can be >> iterated over in a `for...in` loop. If it would make you happy, for the >> rest of the discussion, let's suppose we called the protocol `ForLoopable` >> inste

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

2017-10-14 Thread Michael Ilseman via swift-evolution
I think that “match” is a word to avoid for this, as this doesn’t have anything to do with pattern matching, fuzzy matching, etc., while “equals” is precisely the concept we’re using. What about the name “sequentiallyEquals”? Highlight the fact that we’re talking about sequential ordering, i.e

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

2017-10-14 Thread Kevin Nattinger via swift-evolution
>> […] >> * A Swift `Sequence` is, to put it simplistically, a thing that can be >> iterated over in a `for...in` loop. If it would make you happy, for the rest >> of the discussion, let's suppose we called the protocol `ForLoopable` >> instead of `Sequence`. > > ForLoopable is so ugly. Since w

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

2017-10-14 Thread Ole Begemann via swift-evolution
> One rationale I heard (I think from Ben Cohen) for why 'first' is not defined > on Collection is that Sequences can be single-pass, and it would feel weird > for a seemingly innocuous property like 'first' to have side effects. This should be "not defined on Sequence", of course. Apologies for

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

2017-10-14 Thread Xiaodi Wu via swift-evolution
On Sat, Oct 14, 2017 at 16:22 Ole Begemann wrote: > > On 14. Oct 2017, at 21:55, Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > > On Sat, Oct 14, 2017 at 14:36 Benjamin G > wrote: > >> I think what you're saying and what Kevin is saying are in way not >> contradictory : >>

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

2017-10-14 Thread Ole Begemann via swift-evolution
> On 14. Oct 2017, at 21:55, Xiaodi Wu via swift-evolution > wrote: > > On Sat, Oct 14, 2017 at 14:36 Benjamin G > wrote: > I think what you're saying and what Kevin is saying are in way not > contradictory : > > You're saying the "SpongeBob" protocol fu

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

2017-10-14 Thread Benjamin G via swift-evolution
I'm sorry but you're still arguing about the coherence of the protocol (which you did convinced me about). What some people still argue about is the impact on the coherence of the Set. On Sat, Oct 14, 2017 at 9:54 PM, Xiaodi Wu wrote: > > On Sat, Oct 14, 2017 at 14:36 Benjamin G > wrote: > >> I

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

2017-10-14 Thread Benjamin G via swift-evolution
To answer more precisely this request (which remains valid no matter the protocol hierarchy). I propose "matchesSequence" ( or simply "matches" or "match", whatever is more coherent with the naming guidelines). So var a: [Int] = [1,2,3] a.matchesSequence([1,2,3]) returns true. I first thought th

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

2017-10-14 Thread Xiaodi Wu via swift-evolution
On Sat, Oct 14, 2017 at 14:36 Benjamin G wrote: > I think what you're saying and what Kevin is saying are in way not > contradictory : > > You're saying the "SpongeBob" protocol functions make sense and are > coherent, Kevin is saying the consequence is that it creates weird > functions for Sets,

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

2017-10-14 Thread Benjamin G via swift-evolution
I think what you're saying and what Kevin is saying are in way not contradictory : You're saying the "SpongeBob" protocol functions make sense and are coherent, Kevin is saying the consequence is that it creates weird functions for Sets, and i think you're both right. an "UnorderedSequence" may v

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

2017-10-14 Thread Karim Nassar via swift-evolution
rim > On Oct 13, 2017, at 5:52 PM, swift-evolution-requ...@swift.org wrote: > > From: Christopher Whidden <mailto:christopher.whid...@gmail.com>> > To: Xiaodi Wu mailto:xiaodi...@gmail.com>> > Cc: swift-evolution <mailto:swift-evolution@swift.org>>

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

2017-10-14 Thread Thorsten Seitz via swift-evolution
Well said, Kevin! I agree to all points you made. Yes, a Set has no intrinsic order, just an iteration over a set has. And the latter does not even have to be stable. Let’s split Iterable off Sequence. -Thorsten > Am 14.10.2017 um 09:28 schrieb Kevin Nattinger via swift-evolution > : > > >

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

2017-10-14 Thread Thorsten Seitz via swift-evolution
Totally agree with Kevin’s analysis. I always thought „Sequence“ a very misleading name for an Iterable. I wouldn’t mind the breakage at all. -Thorsten > Am 13.10.2017 um 06:57 schrieb Kevin Nattinger via swift-evolution > : > > –∞ > > 1. I strongly object to the proposed name. It doesn't ma

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

2017-10-14 Thread Xiaodi Wu via swift-evolution
On Sat, Oct 14, 2017 at 2:28 AM, Kevin Nattinger wrote: > > On Oct 13, 2017, at 8:28 PM, Xiaodi Wu wrote: > > > > On Fri, Oct 13, 2017 at 12:03 PM, Kevin Nattinger > wrote: > >> On Oct 13, 2017, at 6:52 AM, Xiaodi Wu wrote: >> >> You’re welcome to bikeshed the entire API surface area of sequen

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

2017-10-14 Thread Kevin Nattinger via swift-evolution
> On Oct 13, 2017, at 8:28 PM, Xiaodi Wu wrote: > > > > On Fri, Oct 13, 2017 at 12:03 PM, Kevin Nattinger > wrote: >> On Oct 13, 2017, at 6:52 AM, Xiaodi Wu > > wrote: >> >> You’re welcome to bikeshed the entire API surface area of sequ

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

2017-10-13 Thread Xiaodi Wu via swift-evolution
On Fri, Oct 13, 2017 at 11:58 PM, Adam Kemp wrote: > > That the proposed name is obtuse is intentional--as Nate has > surmised--as a way to prompt the unfamiliar user to look up the > documentation. > > This is a strange philosophy for naming things. I see what you’re saying, > but it feels very

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

2017-10-13 Thread Adam Kemp via swift-evolution
> That the proposed name is obtuse is intentional--as Nate has surmised--as a > way to prompt the unfamiliar user to look up the documentation. This is a strange philosophy for naming things. I see what you’re saying, but it feels very wrong to deliberately name something such that people will n

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

2017-10-13 Thread Xiaodi Wu via swift-evolution
On Fri, Oct 13, 2017 at 8:45 PM, Brent Royal-Gordon wrote: > > On Oct 12, 2017, at 9:57 PM, Kevin Nattinger via swift-evolution < > swift-evolution@swift.org> wrote: > > > > That is reflected in the fact that over half the methods in the main > Sequence definition* make no sense and are not well-

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

2017-10-13 Thread Xiaodi Wu via swift-evolution
On Fri, Oct 13, 2017 at 4:52 PM, Christopher Whidden < christopher.whid...@gmail.com> wrote: > Using the term “lexicographically” implies to me that the Element type > must conform to Comparable, as would be required for a total order. The > Sequence method you mention, lexicographicallyPrecedes(

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

2017-10-13 Thread Xiaodi Wu via swift-evolution
On Fri, Oct 13, 2017 at 3:06 PM, Jonathan Hull wrote: > It has been a while, but I believe a lexicographical ordering is basically > a mapping from a set to the natural numbers (which should, in effect, > provide a total ordering). The mapping itself can be arbitrary, but the > same set of thing

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

2017-10-13 Thread Xiaodi Wu via swift-evolution
On Fri, Oct 13, 2017 at 12:12 PM, Kevin Nattinger wrote: > > On Oct 13, 2017, at 10:01 AM, Michael Ilseman wrote: > > > > On Oct 12, 2017, at 9:57 PM, Kevin Nattinger via swift-evolution < > swift-evolution@swift.org> wrote: > > –∞ > > 1. I strongly object to the proposed name. It doesn't make i

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

2017-10-13 Thread Xiaodi Wu via swift-evolution
On Fri, Oct 13, 2017 at 10:28 AM, Adam Kemp wrote: > > > -- > Adam Kemp > > On Oct 13, 2017, at 7:59 AM, Xiaodi Wu wrote: > > On Fri, Oct 13, 2017 at 09:02 Adam Kemp wrote: > >> Right, but if you do look it up you get a bunch of things talking about >> sorting words. >> > > And that’s a perfect

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

2017-10-13 Thread Brent Royal-Gordon via swift-evolution
> On Oct 12, 2017, at 9:57 PM, Kevin Nattinger via swift-evolution > wrote: > > That is reflected in the fact that over half the methods in the main Sequence > definition* make no sense and are not well-defined unless there is a > well-defined order to the sequence itself. What does it even me

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

2017-10-13 Thread Max Moiseev via swift-evolution
> On Oct 13, 2017, at 1:34 PM, Howard Lovatt via swift-evolution > wrote: > > I am very glad that this issue is getting some air time since the ‘loose’ > definitions in `Sequence` are a pain. > > I am in the camp that thinks the best solution is to split `Sequence`. I > would propose split

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

2017-10-13 Thread Christopher Whidden via swift-evolution
Using the term “lexicographically” implies to me that the Element type must conform to Comparable, as would be required for a total order. The Sequence method you mention, lexicographicallyPrecedes(_:), does have this constraint, whereas the method in question for elementsEqual(_:) / lexicogra

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

2017-10-13 Thread Howard Lovatt via swift-evolution
I am very glad that this issue is getting some air time since the ‘loose’ definitions in `Sequence` are a pain. I am in the camp that thinks the best solution is to split `Sequence`. I would propose splitting into `Iterable` and `Sequence`, `Sequence` is ordered. `Set` and `Dictionary` would i

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

2017-10-13 Thread Jonathan Hull via swift-evolution
It has been a while, but I believe a lexicographical ordering is basically a mapping from a set to the natural numbers (which should, in effect, provide a total ordering). The mapping itself can be arbitrary, but the same set of things should never map to two different sequences (which just hap

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

2017-10-13 Thread Jonathan Hull via swift-evolution
I would also expect lexicographicallyEquals to sort the elements (or otherwise create/reference a total ordering) before checking for equality. I would be more surprised by the behavior of a function named this than elementsEqual. Given the name, I would expect elementsEqual to return true if t

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

2017-10-13 Thread Kevin Nattinger via swift-evolution
> > Is seems like you’re arguing we should attack the “Ordered versus unordered” > dichotomy prior to any name change. Is that correct? > Yes, that's exactly my primary argument. (The secondary argument being that in either case the name should not be changed, at least not to the proposed on

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

2017-10-13 Thread Michael Ilseman via swift-evolution
> On Oct 13, 2017, at 10:12 AM, Kevin Nattinger wrote: > >> >> On Oct 13, 2017, at 10:01 AM, Michael Ilseman > > wrote: >> >> >> >>> On Oct 12, 2017, at 9:57 PM, Kevin Nattinger via swift-evolution >>> mailto:swift-evolution@swift.org>> wrote: >>> >>> –∞ >>> >>

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

2017-10-13 Thread Jarod Long via swift-evolution
The name that feels natural to me would be `sequentiallyEquals`. I don't dispute that the term "lexicographical" is used correctly here, although at least for me personally, it's not a word that I encounter frequently enough to understand what this method would do without reading the documentati

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

2017-10-13 Thread Benjamin G via swift-evolution
Ok, sorry for that answer that was really too quick. It seems that i really didn't answer the rational for the "elementsEqual" function in the first place which seems to be related to comparing sequences of different types, so just ignore my last comment. I do however wants to reiterate my encoura

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

2017-10-13 Thread Kevin Nattinger via swift-evolution
> On Oct 13, 2017, at 10:01 AM, Michael Ilseman wrote: > > > >> On Oct 12, 2017, at 9:57 PM, Kevin Nattinger via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> –∞ >> >> 1. I strongly object to the proposed name. It doesn't make it more clear to >> me what the method doe

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

2017-10-13 Thread Benjamin G via swift-evolution
Hi, i'm not following this mailing for a long enough time, so i'm sorry if all this conversation already took place. It seems however pretty obvious to me what "ordered" and "unordered" means, and , knowing that collections have value semantics in swift, i would expect the regular "==" to take that

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

2017-10-13 Thread Michael Ilseman via swift-evolution
> On Oct 12, 2017, at 9:57 PM, Kevin Nattinger via swift-evolution > wrote: > > –∞ > > 1. I strongly object to the proposed name. It doesn't make it more clear to > me what the method does, and is misleading at best. Among other issues, > "lexicographical" is defined as alphabet order, and

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

2017-10-13 Thread Nate Cook via swift-evolution
> On Oct 13, 2017, at 9:59 AM, Xiaodi Wu via swift-evolution > wrote: > >> On Fri, Oct 13, 2017 at 09:02 Adam Kemp wrote: >> Right, but if you do look it up you get a bunch of things talking about >> sorting words. > > And that’s a perfect description of the behavior. It’s a lexicographical

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

2017-10-13 Thread Adam Kemp via swift-evolution
-- Adam Kemp > On Oct 13, 2017, at 7:59 AM, Xiaodi Wu wrote: > >> On Fri, Oct 13, 2017 at 09:02 Adam Kemp wrote: >> Right, but if you do look it up you get a bunch of things talking about >> sorting words. > > And that’s a perfect description of the behavior. It’s a lexicographical > compa

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

2017-10-13 Thread Xiaodi Wu via swift-evolution
On Fri, Oct 13, 2017 at 09:02 Adam Kemp wrote: > Right, but if you do look it up you get a bunch of things talking about > sorting words. > And that’s a perfect description of the behavior. It’s a lexicographical comparison operation! How about pairwiseEqual? > A lexicographical comparison com

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

2017-10-13 Thread Adam Kemp via swift-evolution
Right, but if you do look it up you get a bunch of things talking about sorting words. How about pairwiseEqual? -- Adam Kemp > On Oct 13, 2017, at 5:17 AM, Xiaodi Wu wrote: > > “Lexicographical comparison” is a pretty standard term, and easy to Google. > We didn’t make it up for Swift :) >

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

2017-10-13 Thread Xiaodi Wu via swift-evolution
You’re welcome to bikeshed the entire API surface area of sequences and collections, but you won’t be the first to explore this area. A number of us looked into this area in the past few years and did not reach a measurable improved result. Sequences can be ordered or unordered, single-pass or mul

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

2017-10-13 Thread Kevin Nattinger via swift-evolution
> 1. We could go ahead and make this separation. Although it's a potentially > large breaking change, I would argue that because the methods are ill-defined > anyway, the breakage is justified and a net benefit. > > 2. We could try and think of a way to make the distinction between ordered > a

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

2017-10-13 Thread Xiaodi Wu via swift-evolution
“Lexicographical comparison” is a pretty standard term, and easy to Google. We didn’t make it up for Swift :) Since Swift names this protocol Sequence, something named “Sequence.sequenceEqual” cannot distinguish this method from ==. On Fri, Oct 13, 2017 at 01:28 Adam Kemp wrote: > I agree that

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

2017-10-13 Thread Benjamin G via swift-evolution
+1 on both points. As for your solutions, i see 1/ as the best solution. Breaking source code that rely on badly defined, or improper behavior isn't "breaking". You don't break something that's already half broken. As an app developer relying on swift on my day to day job and making a living of it

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

2017-10-12 Thread Adam Kemp via swift-evolution
I agree that the proposed name is a poor choice. If we just focus on the naming part, there is precedent in other languages for the name “sequenceEqual”. I think that name makes it a bit clearer that the result is whether the sequences match pair wise rather than whether they have the same eleme

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

2017-10-12 Thread Kevin Nattinger via swift-evolution
–∞ 1. I strongly object to the proposed name. It doesn't make it more clear to me what the method does, and is misleading at best. Among other issues, "lexicographical" is defined as alphabet order, and (1) this method applies to objects that are not Strings, and (2) this method's behavior isn'

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

2017-10-12 Thread David Hart via swift-evolution
+1 Agree with the reasoning and that this is the best solution. It reduces the risk of confusing the function for what it’s not. > On 13 Oct 2017, at 01:37, Kelvin Ma via swift-evolution > wrote: > > I’ve always hated the use of the word “lexicographically” in that method 1) > because lexico

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

2017-10-12 Thread Kelvin Ma via swift-evolution
I’ve always hated the use of the word “lexicographically” in that method 1) because lexicographically is hard to spell, and 2) because it’s weird to say that an unordered collection has a lexicographical order. But this change is probably for the best. On Thu, Oct 12, 2017 at 6:24 PM, Xiaodi Wu vi

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

2017-10-12 Thread Xiaodi Wu via swift-evolution
Rename Sequence.elementsEqual - Proposal: SE- - Authors: Xiaodi Wu - Review Manager: TBD - Status: *Awaiting review*

<    1   2