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

Tony Allevato tony.allevato at gmail.com
Wed Aug 9 19:11:11 CDT 2017


On Wed, Aug 9, 2017 at 4:36 PM Xiaodi Wu via swift-evolution <
swift-evolution at swift.org> wrote:

> On Wed, Aug 9, 2017 at 6:08 PM, Chris Lattner via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>> Hello Swift community,
>>
>> The review of SE-0185 - "Synthesizing Equatable and Hashable conformance"
>> begins now and runs through August 15, 2017. The proposal is available here:
>>
>> https://github.com/apple/swift-evolution/blob/master/proposals/0185-synthesize-equatable-hashable.md
>>
>>
>> Reviews are an important part of the Swift evolution process. All reviews
>> should be sent to the swift-evolution mailing list at:
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>
>> or, if you would like to keep your feedback private, directly to the
>> review manager. When replying, please try to keep the proposal link at the
>> top of the message:
>>
>> What goes into a review?
>>
>> The goal of the review process is to improve the proposal under review
>> through constructive criticism and, eventually, determine the direction of
>> Swift. When writing your review, here are some questions you might want to
>> answer in your review:
>>
>>         • What is your evaluation of the proposal?
>>
>
> Brilliant. However, I believe that this is a typo of some importance to
> clarify:
>
> > The compiler synthesizes P's requirements for a struct with one or more
> stored properties if and only if all of the types of all of its stored
> properties conform to P.
>
> I think the author means to write "...conform to {Equatable | Hashable}";
> it is unclear what it means for a struct P to have stored properties that
> "conform to P" (which would be an odd restriction in any case). The same
> issue occurs in preceding bulleted list with respect to enums.
>

In that statement, P is intended to be the protocol (Equatable or
Hashable), not the struct—but I can see how "P's requirements" might be
interpreted either way. In an earlier paragraph I state "For brevity, let P
represent either the protocol Equatable or Hashable in the descriptions
below." In other words:

"The compiler synthesizes {Equatable|Hashable}'s requirements for a struct
with one or more stored properties if and only if all of the types of all
of its stored properties conform to {Equatable|Hashable}."

Hopefully that clarifies, but I can update the write-up if necessary.



>
>>         • Is the problem being addressed significant enough to warrant a
>> change to Swift?
>>
>
> This is a wonderful addition.
>
>
>>         • Does this proposal fit well with the feel and direction of
>> Swift?
>>
>
> Yes, the author did an excellent job paralleling the existing rules for
> Codable synthesis; I agree fully with that approach as it makes this
> feature more easily learnable and predictable for all users.
>
>
>>         • If you have used other languages or libraries with a similar
>> feature, how do you feel that this proposal compares to those?
>>
>
> I haven't in recent times, but I do know that other languages do this.
>
>
>>         • How much effort did you put into your review? A glance, a quick
>> reading, or an in-depth study?
>>
>
> A quick reading today; an in-depth study previously.
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170810/6b6131e4/attachment.html>


More information about the swift-evolution mailing list