<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Although I like the idea, I think it should be more general, as this
    same reasoning also holds for other operators.<br>
    Wouldn't it be better to allow to define operators within a type? So
    that we can just implement == in the type?<br>
    <br>
    I do not know how hard it is to implement it or if this is even
    possible. Probably it is hard, because otherwise it would already
    have been done?<br>
    <pre class="moz-signature" cols="72">Regards,

Nicky</pre>
    <div class="moz-cite-prefix">On 12/08/2015 11:01 AM, Richard Fox via
      swift-evolution wrote:<br>
    </div>
    <blockquote
cite="mid:CAKK64=ggLQwCsSBH9MBzoQ5KJP=Vbgs0yNV6EazDJ0h6WByO5Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <h3
          style="margin-bottom:16px;line-height:1.43;font-size:1.5em;color:rgb(51,51,51);font-family:'Helvetica
          Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple
          Color Emoji','Segoe UI Emoji','Segoe UI
          Symbol';margin-top:0px!important"><span
            style="font-size:16px;line-height:25.6px;font-weight:normal">Hi
            all,</span><br>
        </h3>
        <p
          style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica
          Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple
          Color Emoji','Segoe UI Emoji','Segoe UI
          Symbol';font-size:16px;line-height:25.6px">I would like to
          propose changing the Equatable protocol to use <code
            style="font-family:Consolas,'Liberation
            Mono',Menlo,Courier,monospace;font-size:13.6px;padding:0.2em
0px;margin:0px;border-radius:3px;background-color:rgba(0,0,0,0.0392157)">isEqual(to:Self)
            -&gt; Bool</code>, defined inside of a type to replace the
          currently used operator <code
            style="font-family:Consolas,'Liberation
            Mono',Menlo,Courier,monospace;font-size:13.6px;padding:0.2em
0px;margin:0px;border-radius:3px;background-color:rgba(0,0,0,0.0392157)">==</code> function,
          which is defined outside of the type.</p>
        <h3
          style="margin-top:1em;margin-bottom:16px;line-height:1.43;font-size:1.5em;color:rgb(51,51,51);font-family:'Helvetica
          Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple
          Color Emoji','Segoe UI Emoji','Segoe UI Symbol'"><a
            moz-do-not-send="true" id="user-content-reasoning"
            class="anchor"
            href="https://gist.github.com/Nadohs/308603afa65cbbfba07c#reasoning"
style="color:rgb(64,120,192);text-decoration:none;display:inline-block;padding-right:2px;line-height:1.2;background-color:transparent"><span
              class="octicon octicon-link"
style="font-weight:normal;font-stretch:normal;font-size:16px;line-height:1;font-family:octicons;display:inline-block;color:rgb(0,0,0);vertical-align:middle"></span></a>Reasoning:</h3>
        <ol style="padding:0px 0px 0px
          2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica
          Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple
          Color Emoji','Segoe UI Emoji','Segoe UI
          Symbol';font-size:16px;line-height:25.6px">
          <li style="box-sizing: border-box;">Having the conforming
            function defined inside of the type is more intuitive, since
            in general functions required for conformance are defined
            within the type. It feels like an unnecesary detail for
            learners of Swift to have to stumble through.</li>
        </ol>
        <p
          style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica
          Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple
          Color Emoji','Segoe UI Emoji','Segoe UI
          Symbol';font-size:16px;line-height:25.6px">The implementation
          for this would look something like this:</p>
        <pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;font-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;color:rgb(51,51,51);background-color:rgb(247,247,247)"><code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:3px;word-break:normal;border:0px;display:inline;max-width:initial;overflow:initial;line-height:inherit;word-wrap:normal;background:transparent">     public protocol Equatable{
       ....

       /// Shortcut for defining `==` function inside type definition.
       @warn_unused_result
       func isEqual(to:Self) -&gt; Bool
     }

     @warn_unused_result
     public func == &lt;T : Equatable&gt;(lhs: T, rhs: T) -&gt; Bool {
         return lhs.isEqual(rhs)
     }
</code></pre>
        <h3
          style="margin-top:1em;margin-bottom:16px;line-height:1.43;font-size:1.5em;color:rgb(51,51,51);font-family:'Helvetica
          Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple
          Color Emoji','Segoe UI Emoji','Segoe UI Symbol'"><a
            moz-do-not-send="true"
            id="user-content-impact-on-existing-code" class="anchor"
href="https://gist.github.com/Nadohs/308603afa65cbbfba07c#impact-on-existing-code"
style="color:rgb(64,120,192);text-decoration:none;display:inline-block;padding-right:2px;line-height:1.2;background-color:transparent"><span
              class="octicon octicon-link"
style="font-weight:normal;font-stretch:normal;font-size:16px;line-height:1;font-family:octicons;display:inline-block;color:rgb(0,0,0);vertical-align:middle"></span></a>Impact
          on Existing Code:</h3>
        <p
          style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica
          Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple
          Color Emoji','Segoe UI Emoji','Segoe UI
          Symbol';font-size:16px;line-height:25.6px">This implementation
          would break existing code, but could be fixed with a default
          protocol extension such as:</p>
        <pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;font-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;color:rgb(51,51,51);background-color:rgb(247,247,247)"><code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:3px;word-break:normal;border:0px;display:inline;max-width:initial;overflow:initial;line-height:inherit;word-wrap:normal;background:transparent">     /// Default `isEqual` function to satisfy other types only definiting
     /// `==` for equality.
     public extension Equatable{
         func isEqual(to:Self) -&gt; Bool{
             return self == to
         }
     }  
</code></pre>
        <p
          style="margin-top:0px;color:rgb(51,51,51);font-family:'Helvetica
          Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple
          Color Emoji','Segoe UI Emoji','Segoe UI
          Symbol';font-size:16px;line-height:25.6px;margin-bottom:0px!important">Not
          adding the default function for <code
            style="font-family:Consolas,'Liberation
            Mono',Menlo,Courier,monospace;font-size:13.6px;padding:0.2em
0px;margin:0px;border-radius:3px;background-color:rgba(0,0,0,0.0392157)">isEqual</code> makes
          more sense to me though, since it would remove any strict
          requirement for Equatable conformance and leave no warning for
          the loop you would create by implementing neither <code
            style="font-family:Consolas,'Liberation
            Mono',Menlo,Courier,monospace;font-size:13.6px;padding:0.2em
0px;margin:0px;border-radius:3px;background-color:rgba(0,0,0,0.0392157)">isEqual</code> nor <code
            style="font-family:Consolas,'Liberation
            Mono',Menlo,Courier,monospace;font-size:13.6px;padding:0.2em
0px;margin:0px;border-radius:3px;background-color:rgba(0,0,0,0.0392157)">==</code>.<br>
          <br>
          Regards,<br>
          Rich Fox</p>
      </div>
      <img moz-do-not-send="true"
src="https://u2002410.ct.sendgrid.net/wf/open?upn=RHl2la-2BftHBRgU0PDt5l8enF-2FEQjC5JypuWCzFZiX9RFxTQ-2BMiLiXWVDri-2FqZ9JkpZYRyntAD5jDorctLW3ieg6VPkteLjD3FEN-2FKRo0WrLD1wpmOa7FzqmnIGlfXAu5ENo5Rp7dwXhSjXq5AfIMpfKl5LKljZaicWmxHb5T87j-2Bt-2BSsySAGP4rHwB5kkwh4Iux3jWEmK2pYJ9qD29vNPE6rw-2FxjVTQrk2SE3ZsGXZ4-3D"
        alt="" style="height:1px !important;width:1px
        !important;border-width:0 !important;margin-top:0
        !important;margin-bottom:0 !important;margin-right:0
        !important;margin-left:0 !important;padding-top:0
        !important;padding-bottom:0 !important;padding-right:0
        !important;padding-left:0 !important;" height="1" width="1"
        border="0">
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
swift-evolution mailing list
<a class="moz-txt-link-abbreviated" href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>
<a class="moz-txt-link-freetext" href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>