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

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

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

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*:

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

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 >>>

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

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

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

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

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 >>>

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.

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

Re: [swift-evolution] commas optional

2017-10-15 Thread Mike Kluev via swift-evolution
On 16 October 2017 at 01:20, Dave Yost wrote: > Nuance: > > Compiler says: > Expression following ‘return’ is treated as an argument of the 'return > '. > unless foo() is indented by at least one space. Then there is no > complaint. > to have more fun try this: return

Re: [swift-evolution] commas optional

2017-10-15 Thread Dave Yost via swift-evolution
Nuance: Compiler says: Expression following ‘return’ is treated as an argument of the 'return'. unless foo() is indented by at least one space. Then there is no complaint. > On 2017-10-15, at 4:32 PM, Dave Yost wrote: > > Very cool! > > func foo() -> Int { return 17 } > >

Re: [swift-evolution] commas optional

2017-10-15 Thread Dave Yost via swift-evolution
Very cool! func foo() -> Int { return 17 } func bug1() -> Int { return foo() // Compiler says: Expression following ‘return' //is treated as an argument of the 'return'. } var x = 0 func bug2() { return x = 4 // not even a warning – should be an error }

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

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

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? > >

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] /*Let it be*/ func() -> @discardable Bool {} /*Rather Than*/ @discardableResult func() -> Bool {}

2017-10-15 Thread C. Keith Ray via swift-evolution
+1 to "discardable" or "@discardable" next to the result type. ] A simple “discardable” would be great. If the result is Bool and ] “discardable” is placed right in front of it, it’s not only more readable ] but also eliminates the redundant word “Result”. Also no at sign is great. -- C. Keith

Re: [swift-evolution] /*Let it be*/ func() -> @discardable Bool {} /*Rather Than*/ @discardableResult func() -> Bool {}

2017-10-15 Thread Rudolf Adamkovič via swift-evolution
+1 A simple “discardable” would be great. If the result is Bool and “discardable” is placed right in front of it, it’s not only more readable but also eliminates the redundant word “Result”. Also no at sign is great. Plus, this is super-straightforward to convert for the compiler when

Re: [swift-evolution] /*Let it be*/ func() -> @discardable Bool {} /*Rather Than*/ @discardableResult func() -> Bool {}

2017-10-15 Thread Jean-Daniel via swift-evolution
> Le 15 oct. 2017 à 15:52, Mike Kluev via swift-evolution > a écrit : > > On 15 October 2017 at 14:23, Geordie Jay > wrote: > Hi Mike, > > 2017-10-15 14:55 GMT+02:00 Mike Kluev

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

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

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

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 >

Re: [swift-evolution] commas optional

2017-10-15 Thread Mike Kluev via swift-evolution
on Date: Fri, 13 Oct 2017 20:21:22 -0700 Chris Lattner wrote: We already have whitespace sensitive rules to handle this. There is no > fundamental implementation difference that I see between separating the > elements of lists (which are expressions) and the elements of

Re: [swift-evolution] /*Let it be*/ func() -> @discardable Bool {} /*Rather Than*/ @discardableResult func() -> Bool {}

2017-10-15 Thread Mike Kluev via swift-evolution
On 15 October 2017 at 14:23, Geordie Jay wrote: > Hi Mike, > > 2017-10-15 14:55 GMT+02:00 Mike Kluev : > >> On 15 October 2017 at 13:35, Geordie Jay wrote: >> >>> Also we're not talking about whether the Bool itself is discardable. For

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 >

Re: [swift-evolution] /*Let it be*/ func() -> @discardable Bool {} /*Rather Than*/ @discardableResult func() -> Bool {}

2017-10-15 Thread Geordie Jay via swift-evolution
Hi Mike, 2017-10-15 14:55 GMT+02:00 Mike Kluev : > On 15 October 2017 at 13:35, Geordie Jay wrote: > >> Also we're not talking about whether the Bool itself is discardable. For >> example, it makes no sense to write: >> >> *let something: discardable Bool

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,

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

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

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

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

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

2017-10-15 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