Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-20 Thread Daryle Walker via swift-evolution
> On Aug 19, 2017, at 3:29 PM, Haravikk via swift-evolution > wrote: > >> On 19 Aug 2017, at 19:46, Daryle Walker > > wrote: >> >>> On Aug 19, 2017, at 7:06 AM, Haravikk via swift-evolution >>> mailto:swift-evolution@swift.org>> wrote: >>> >>> Agreed. To be clear thoug

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-19 Thread David Ungar via swift-evolution
Chris Lattner wrote: > Also, if I were to nitpick your argument a bit, it isn’t true that the > protocol knows “nothing" about the type anyway, because the protocol has > access to self. The default implementation could conceptually use reflection > to access all the state in the type: we’re p

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-19 Thread Xiaodi Wu via swift-evolution
On Sat, Aug 19, 2017 at 3:26 PM, Goffredo Marocchi wrote: > Sorry, I thought that the default implementation in the protocol extension > was how this was provided. > > Providing Default Implementations > > You can use protocol extensions to provide a default implementation to any > method or comp

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-19 Thread Goffredo Marocchi via swift-evolution
Sorry, I thought that the default implementation in the protocol extension was how this was provided. > Providing Default Implementations > You can use protocol extensions to provide a default implementation to any > method or computed property requirement of that protocol > https://developer.

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-19 Thread Haravikk via swift-evolution
> On 19 Aug 2017, at 19:46, Daryle Walker wrote: > >> On Aug 19, 2017, at 7:06 AM, Haravikk via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >>> On 19 Aug 2017, at 11:44, Tino Heth <2...@gmx.de > >>> wrote: Am 17.08.2017 um 20:11 schrieb Haravikk vi

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-19 Thread Daryle Walker via swift-evolution
> On Aug 19, 2017, at 7:06 AM, Haravikk via swift-evolution > wrote: > >> On 19 Aug 2017, at 11:44, Tino Heth <2...@gmx.de > wrote: >>> Am 17.08.2017 um 20:11 schrieb Haravikk via swift-evolution >>> mailto:swift-evolution@swift.org>>: >>> For me the whole point of a basic p

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-19 Thread Xiaodi Wu via swift-evolution
On Sat, Aug 19, 2017 at 1:13 PM, Goffredo Marocchi wrote: > We can override the protocol default implementation in the extension, but > the issue I see with default implementation in Swift is that if I pass the > object created this way around in a type erased container (Any : Protocol1 > like

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-19 Thread Goffredo Marocchi via swift-evolution
We can override the protocol default implementation in the extension, but the issue I see with default implementation in Swift is that if I pass the object created this way around in a type erased container (Any : Protocol1 like it was common for many to pass id around in the Objective-C days,

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-19 Thread Xiaodi Wu via swift-evolution
On Sat, Aug 19, 2017 at 06:07 Haravikk via swift-evolution < swift-evolution@swift.org> wrote: > > On 19 Aug 2017, at 11:44, Tino Heth <2...@gmx.de> wrote: > > Am 17.08.2017 um 20:11 schrieb Haravikk via swift-evolution < > swift-evolution@swift.org>: > > For me the whole point of a basic protocol

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-19 Thread Haravikk via swift-evolution
> On 19 Aug 2017, at 11:44, Tino Heth <2...@gmx.de> wrote: >> Am 17.08.2017 um 20:11 schrieb Haravikk via swift-evolution >> mailto:swift-evolution@swift.org>>: >> For me the whole point of a basic protocol is that it forces me to implement >> some requirements in order to conform; I can throw a

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-19 Thread Tino Heth via swift-evolution
> Am 17.08.2017 um 20:11 schrieb Haravikk via swift-evolution > : > > For me the whole point of a basic protocol is that it forces me to implement > some requirements in order to conform; I can throw a bunch of protocols onto > a type and know that it won't compile until I've finished it, deve

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-17 Thread Nevin Brackett-Rozinsky via swift-evolution
I am really glad this is happening, it will make implementing basic data types much nicer, and it is exactly the sort of feature that saves developers from having to waste time thinking about trivial rote boilerplate both when writing and when reading code—an excellent and welcome addition to the l

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-17 Thread Haravikk via swift-evolution
> On 17 Aug 2017, at 18:04, Chris Lattner wrote: >> On Aug 17, 2017, at 5:00 AM, Haravikk via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >>> On 17 Aug 2017, at 11:42, Robert Bennett >> > wrote: >>> >>> Chris mentions that the intent was to mimic a

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-17 Thread Chris Lattner via swift-evolution
> On Aug 17, 2017, at 5:00 AM, Haravikk via swift-evolution > wrote: > > >> On 17 Aug 2017, at 11:42, Robert Bennett > > wrote: >> >> Chris mentions that the intent was to mimic a default implementation in a >> constrained protocol extension, with one extension

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-17 Thread Haravikk via swift-evolution
> On 17 Aug 2017, at 11:42, Robert Bennett wrote: > > Chris mentions that the intent was to mimic a default implementation in a > constrained protocol extension, with one extension per type that doesn’t > define its own ==/hashValue while conforming to Equatable/Hashable. > Constrained extens

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-17 Thread Robert Bennett via swift-evolution
Chris mentions that the intent was to mimic a default implementation in a constrained protocol extension, with one extension per type that doesn’t define its own ==/hashValue while conforming to Equatable/Hashable. Constrained extensions are allowed to use type information from the constraint, s

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-17 Thread Haravikk via swift-evolution
> On 17 Aug 2017, at 00:06, Robert Bennett via swift-evolution > wrote: > > How do unstable hash values play with Codable? If you encode and save a Set, > might you have problems interacting with it in the future? (This is more a > Codable question than Hashable, but I figure I might as well

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-16 Thread Tony Allevato via swift-evolution
So the concern is that you have a Set of values with derived hashes, it gets encoded, and then a later run of the program decodes that payload, the hash values are different and performance suffers because collisions occur where they previously didn't? (Correctness would never be an issue, since co

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-16 Thread Xiaodi Wu via swift-evolution
If I understand the question correctly, Robert's asking whether the possibility that hashes might differ on every execution would causes issues if, upon deserializing, one stumbles upon a hash collision which did not occur with the original hashes. And I suppose the answer to that is...yes? On We

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-16 Thread Tony Allevato via swift-evolution
>From what I can tell the hash values of elements in a Set don't come into play during encoding/decoding: they're merely serialized as the sequence of their elements. https://github.com/apple/swift/blob/2e5817ebe15b8c2fc2459e08c1d462053cbb9a99/stdlib/public/core/Codable.swift#L4073-L4097 On Wed,

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-16 Thread Robert Bennett via swift-evolution
How do unstable hash values play with Codable? If you encode and save a Set, might you have problems interacting with it in the future? (This is more a Codable question than Hashable, but I figure I might as well ask here) > On Aug 16, 2017, at 7:02 PM, Matthew Johnson via swift-evolution > w

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-16 Thread Matthew Johnson via swift-evolution
> On Aug 16, 2017, at 5:59 PM, Rudolf Adamkovic via swift-evolution > wrote: > > That's great. Thanks! Yes, excellent news! I am *really* looking forward to seeing this proposal make it into an Xcode release! > > R+ > > On 17 Aug 2017, at 00:46, John McCall > w

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-16 Thread Rudolf Adamkovic via swift-evolution
That's great. Thanks! R+ > On 17 Aug 2017, at 00:46, John McCall wrote: > >> On Aug 16, 2017, at 6:35 PM, Rudolf Adamkovič via swift-evolution >> wrote: >> >> This is fantastic news! Any chance of this landing in Swift 4.x instead of 5? > > It it likely to be available in 4.1, but not 4.0.

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-16 Thread John McCall via swift-evolution
> On Aug 16, 2017, at 6:35 PM, Rudolf Adamkovič via swift-evolution > wrote: > > This is fantastic news! Any chance of this landing in Swift 4.x instead of 5? It it likely to be available in 4.1, but not 4.0. John. > > R+ > >> On 17 Aug 2017, at 00:29, Chris Lattner via swift-evolution >>

Re: [swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-16 Thread Rudolf Adamkovič via swift-evolution
This is fantastic news! Any chance of this landing in Swift 4.x instead of 5? R+ > On 17 Aug 2017, at 00:29, Chris Lattner via swift-evolution > wrote: > > Proposal Link: > https://github.com/apple/swift-evolution/blob/master/proposals/0185-synthesize-equatable-hashable.md > > The review of

[swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

2017-08-16 Thread Chris Lattner via swift-evolution
Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0185-synthesize-equatable-hashable.md The review of SE-0185 “Synthesizing Equatable and Hashable conformance” ran from August 9…15, 2017. Feedback for the feature was glowingly positive, and the proposal is accepted.