<div dir="ltr">On Fri, Mar 31, 2017 at 11:31 AM, Sasha Lopoukhine <span dir="ltr">&lt;<a href="mailto:sasha.swi.evo@gmail.com" target="_blank">sasha.swi.evo@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Completely forgot about those. Thank you. The point still stands, it doesn&#39;t really make sense to multiply strides by each other. I don&#39;t know how this would work, but if we&#39;re already ok to shake up the Integer protocols, then maybe adding one between SignedNumeric and SignedInteger might be ok.</div></blockquote><div><br></div><div>The time for shaking up integer protocols is over, though. During that time, it was considered whether separating Numeric into fields and rings would be useful, which is what you&#39;re asking, but it was thought too esoteric and rejected in favor of the approved design.</div><div><br></div><div><br></div><div> <span style="color:rgb(80,0,80)">On 31 Mar 2017, at 17:25, Xiaodi Wu &lt;</span><a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a><span style="color:rgb(80,0,80)">&gt; wrote:</span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div class="m_-2857655700454287606h5"><div><blockquote type="cite"><br class="m_-2857655700454287606m_-9193931171367476912Apple-interchange-newline"><div><div dir="ltr">Have you seen the revised integer protocols?<div><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0104-improved-integers.md" target="_blank">https://github.com/apple/swift<wbr>-evolution/blob/master/proposa<wbr>ls/0104-improved-integers.md</a><br></div><div><br></div><div>`SignedNumeric` will no longer refine `Comparable`. It will, however, still require that you can define multiplication.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 31, 2017 at 11:09 AM, Sasha Lopoukhine via swift-evolution <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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hello everyone!<div><br></div><div>I&#39;d like to discuss the constraint on Strideable. I see no reason to restrict Strideable types to non-circular types. It would be pretty neat/useful to be able to define a type such as a Week, with strides looping around to the start of the enum. Currently, the only reason this is impossible is because of the restriction on Stride that it must conform to SignedNumber.</div><div><br></div><div>I think that it might be worth looking into defining a new protocol specifically for the constraint on Strideable.Stride, something that looks like this:</div><div><br></div><div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="font-variant-ligatures:no-common-ligatures">/// Instances of conforming types can be subtracted, arithmetically</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="font-variant-ligatures:no-common-ligatures">/// negated, and initialized from `0`.</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="font-variant-ligatures:no-common-ligatures">///</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="font-variant-ligatures:no-common-ligatures">/// Axioms:</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="font-variant-ligatures:no-common-ligatures">///</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="font-variant-ligatures:no-common-ligatures">/// - `x - 0 == x`</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="font-variant-ligatures:no-common-ligatures">/// - `-x == 0 - x`</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="font-variant-ligatures:no-common-ligatures">/// - `-(-x) == x`</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(112,61,170)"><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2">public</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2">protocol</span><span style="font-variant-ligatures:no-common-ligatures"> StrideProtocol : </span><span style="font-variant-ligatures:no-common-ligatures">ExpressibleByIntegerLiteral</span><span style="font-variant-ligatures:no-common-ligatures"> {</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;min-height:15px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="font-variant-ligatures:no-common-ligatures">    </span><span style="font-variant-ligatures:no-common-ligatures">/// Returns the result of negating `x`.</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(186,45,162)"><span style="font-variant-ligatures:no-common-ligatures">    </span><span style="font-variant-ligatures:no-common-ligatures">prefix</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures">public</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures">static</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures">func</span><span style="font-variant-ligatures:no-common-ligatures"> -(x: </span><span style="font-variant-ligatures:no-common-ligatures;color:#703daa">Self</span><span style="font-variant-ligatures:no-common-ligatures">) -&gt; </span><span style="font-variant-ligatures:no-common-ligatures;color:#703daa">Self</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;min-height:15px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="font-variant-ligatures:no-common-ligatures">    </span><span style="font-variant-ligatures:no-common-ligatures">/// Returns the difference between `lhs` and `rhs`.</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">    </span><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2">public</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2">static</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2">func</span><span style="font-variant-ligatures:no-common-ligatures"> -(lhs: </span><span style="font-variant-ligatures:no-common-ligatures;color:#703daa">Self</span><span style="font-variant-ligatures:no-common-ligatures">, rhs: </span><span style="font-variant-ligatures:no-common-ligatures;color:#703daa">Self</span><span style="font-variant-ligatures:no-common-ligatures">) -&gt; </span><span style="font-variant-ligatures:no-common-ligatures;color:#703daa">Self</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">}</span></div></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span style="color:rgb(186,45,162)">public typealias </span></span>SignedNumber <span style="font-variant-ligatures:no-common-ligatures">= </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)">StrideProtocol</span><span style="font-variant-ligatures:no-common-ligatures"> &amp; </span><span style="color:rgb(112,61,170);font-variant-ligatures:no-common-ligatures">Comparable</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div style="margin:0px;line-height:normal">Strideable.Stride could then conform to StrideProtocol, allowing groups etc. </div><div style="margin:0px;line-height:normal"><br></div><div style="margin:0px;line-height:normal">WDYT?</div><span class="m_-2857655700454287606m_-9193931171367476912HOEnZb"><font color="#888888"><div style="margin:0px;line-height:normal"><br></div><div style="margin:0px;line-height:normal">-- Sasha</div><div style="margin:0px;line-height:normal"><br></div></font></span></div><br>______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>
</div></blockquote></div><br></div></div></blockquote></div><br></div></div>