> On Aug 17, 2017, at 5:00 AM, Haravikk via swift-evolution 
> <[email protected]> wrote:
> 
> 
>> On 17 Aug 2017, at 11:42, Robert Bennett <[email protected] 
>> <mailto:[email protected]>> 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 extensions are allowed to use type information from the 
>> constraint, so I don’t think there is an issue here.
> 
> And I disagree; this isn't a constraint extension either, not even close, 
> we're talking here about automatic behaviour based upon variables the 
> protocol knows literally nothing about, in a way that can result in new 
> errors that are currently impossible (as you can't currently conform to 
> Equatable without providing some kind of code to implement it).

I understand and recognize your concern.  Your points are apply equally to the 
default implementation of the Codable protocols as well, and the core team 
specifically discussed this.

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 producing the same effect with more efficient code.

-Chris


_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to