<div dir="ltr">In line below.<div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">  -- Howard.<br></div></div>
<br><div class="gmail_quote">On 1 March 2016 at 05:51, Антон Жилин <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I&#39;m prepairing to create a pull request, so I moved the proposal from Gist to my fork of swift-evolution.<div>Link to the proposal new and hopefully final home:</div><div><a href="https://github.com/Anton3/swift-evolution/blob/mixins/proposals/NNNN-mixins.md" target="_blank">https://github.com/Anton3/swift-evolution/blob/mixins/proposals/NNNN-mixins.md</a><br></div><div><br></div><div>Should I create a pull request right now or wait a bit?</div><div><br><div>Some details need to be discussed:</div><div><br></div><div>1. Do mixins need associated types? Would generics be more appropriate to them?</div></div></div></blockquote><div><br></div><div>I would prefer generics so that they work seamlessly with structs and classes that use generics without having to use type constraints via where clauses</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><br></div><div>2. `mixin` vs `mixin protocol`. On one hand, `mixin protocol` does not require a keyword.</div><div>On the other hand, as stated in a special section, mixins cannot be used everywhere a protocol can. Protocols, mixins, traits, interfaces are all different entities.</div></div></div></blockquote><div><br></div><div>trait, not trait protocol - see below </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>3. `mixin` vs `trait`. Please read Wiki or any other source and tell what is a better name.</div></div></blockquote><div><br></div><div>trait since the proposal is very close to &quot;Traits: Composable Units of Behaviour&quot;, by Nathanael Scha ̈rli, Ste ́phane Ducasse, Oscar Nierstrasz, and Andrew P. Black, which is the paper that 1st proposed traits.</div>
                
        
        
                <div><span style="font-family:Times;font-size:10pt"> </span> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>4. Objective-C interfacing. Do we have to require it now? (I doubt so.) Can we allow mixing-in Swift mixins to Objective-C classes?</div></div></blockquote><div><br></div><div>No protocols are good for that. Keep it simple at 1st, can always be added latter.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>5. Are you happy with Initializers section?</div></div></blockquote><div><br></div><div>Yes </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>6. Can motivation examples be improved?</div></div></blockquote><div><br></div><div>How about adding implementing CustomStringConvertable and Equatable, e.g.:</div><div><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>mixing Shape: CustomStringConvertable, Equatable {</div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>var center: CGPoint = CGPoint.zero</div></div></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>var bounds: CGSize { get } // Note: not implemented</div></div></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>var description: String { return &quot;Shape(center: x: \(center), bounds: \(bounds))&quot;</div></div></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>} </div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>func ==(lhs: Shape, rhs: Shape) -&gt; Bool {</div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>return lhs.center == rhs.center &amp;&amp; lhs.bounds == rhs.bounds</div></div></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>}</div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><br></div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>mixing Line: CustomStringConvertable, Equatable {</div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>var color = UIColor.blackColor()</div></div></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>var width = 1</div><div>var description: String { return &quot;Line(color: x: \(color), width: \(width))&quot;<br></div></div></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>}</div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><div class="gmail_extra"><div class="gmail_quote">func ==(lhs: Line, rhs: Line) -&gt; Bool {</div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote">return lhs.color == rhs.color &amp;&amp; lhs.width == rhs.width</div></div></blockquote><div class="gmail_extra"><div class="gmail_quote">}</div></div></div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"></div></div></blockquote></div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>struct Rectangle: Shape, Line {</div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote">var size: CGSize</div></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote">override var bounds: CGSize { return size } // Implements Shape.bounds</div><div class="gmail_quote">override var description: String { return &quot;Rectangle(shape: x: \(Shape.super.description), Line: \(Line.super.description))&quot;<br></div></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>}</div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div class="gmail_extra"><div class="gmail_quote">func ==(lhs: Rectangle, rhs: Rectangle) -&gt; Bool {</div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote">return (lhs as Shape) == (rhs as Shape) &amp;&amp; (lhs as Line) == (rhs as Line)</div></div></blockquote><div class="gmail_extra"><div class="gmail_quote">}</div></div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"></div></div></blockquote></div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Extra possible improvement. Add a section about resolving a conflict arising from multiple definitions. My suggestion is to mimic the `A.super` syntax used for calling initializers:</div><div><br></div><div> <span style="color:rgb(51,51,51);font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247)">mixin A { </span><span class="" style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247);color:rgb(167,29,93)">var</span><span style="color:rgb(51,51,51);font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247)"> x</span><span style="color:rgb(51,51,51);font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247)"> </span><span class="" style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247);color:rgb(167,29,93)">=</span><span style="color:rgb(51,51,51);font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247)"> </span><span class="" style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247);color:rgb(0,134,179)">0</span><span style="color:rgb(51,51,51);font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247)"> }</span></div><pre style="overflow:auto;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:14px;margin-top:0px;margin-bottom:0px;line-height:1.45;padding:16px;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal;color:rgb(51,51,51)">mixin B { <span class="" style="color:rgb(167,29,93)">var</span> x <span class="" style="color:rgb(167,29,93)">=</span> <span class="" style="color:rgb(0,134,179)">1</span> }
mixin C <span class="" style="color:rgb(167,29,93)">:</span> A, B { override var x = A.super.x }  <span class="" style="color:rgb(150,152,150)">// OK, conflict resolved because x overridden</span></pre><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"></blockquote><div> </div><div>The addition of the `A.super.x` syntax isn&#39;t strictly necessary since you could write `(self as A).x`, but I prefer `A.super.x`.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote">2016-02-29 4:07 GMT+03:00 Step C <span dir="ltr">&lt;<a href="mailto:schristopher@bignerdranch.com" target="_blank">schristopher@bignerdranch.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="auto"><div>Sorry, I understood &quot;that phrase&quot; to mean what I just stated. <br><br></div><div><div><div><br>On Feb 28, 2016, at 8:03 PM, Step C &lt;<a href="mailto:schristopher@bignerdranch.com" target="_blank">schristopher@bignerdranch.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div>I understood him to mean that abstract classes cannot be used for value types, but it would be natural to want that functionality. Mixins would provide that capability for value types as well as classes.<br></div><div><br>On Feb 28, 2016, at 7:41 PM, Trent Nadeau &lt;<a href="mailto:tanadeau@gmail.com" target="_blank">tanadeau@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">The quoted portion of the proposal below doesn&#39;t make any sense to me. Subclasses can&#39;t be value types. Do you mean the structs could have similar functionality?<div><br></div><div><span style="color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px">Firstly, only classes can inherit from such abstract classes, while it can be easily seen that some subclasses of</span><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;color:rgb(51,51,51);background-color:rgba(0,0,0,0.0392157)">CachingSerializable</code><span style="color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px"> or </span><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;color:rgb(51,51,51);background-color:rgba(0,0,0,0.0392157)">SignalSender</code><span style="color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px"> would naturally have value semantics (be structs, in other words).</span><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 28, 2016 at 5:03 PM, Антон Жилин <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Link to the proposal: <a href="https://gist.github.com/Anton3/f0550922c1be0fc5447c" target="_blank">https://gist.github.com/Anton3/f0550922c1be0fc5447c</a></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-29 0:56 GMT+03:00 Step C <span dir="ltr">&lt;<a href="mailto:schristopher@bignerdranch.com" target="_blank">schristopher@bignerdranch.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">It would be helpful if you include the new draft. Or at least a link to it.<br>
<span><br>
&gt; On Feb 28, 2016, at 3:30 PM, Антон Жилин via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt; I have rewritten almost the whole proposal in the last 10 hours. I encourage everyone interested to reread it and suggest fixes, improvements, as well as new directions for discussion.<br>
</span><div><div>&gt; _______________________________________________<br>
&gt; swift-evolution mailing list<br>
&gt; <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br><br clear="all"><span class=""><font color="#888888"><div><br></div>-- <br><div>Trent Nadeau</div>
</font></span></div>
</div></blockquote></div></blockquote></div></div></div></blockquote></div><br></div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>