<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Completely forgot about those. Thank you. The point still stands, it doesn't really make sense to multiply strides by each other. I don't know how this would work, but if we're already ok to shake up the Integer protocols, then maybe adding one between SignedNumeric and SignedInteger might be ok.<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 31 Mar 2017, at 17:25, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Have you seen the revised integer protocols?<div class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0104-improved-integers.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0104-improved-integers.md</a><br class=""></div><div class=""><br class=""></div><div class="">`SignedNumeric` will no longer refine `Comparable`. It will, however, still require that you can define multiplication.</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Mar 31, 2017 at 11:09 AM, Sasha Lopoukhine via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hello everyone!<div class=""><br class=""></div><div class="">I'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 class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class=""><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">/// 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)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">/// 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)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">///</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">/// Axioms:</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">///</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">/// - `x - 0 == x`</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">/// - `-x == 0 - x`</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">/// - `-(-x) == x`</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(112,61,170)" class=""><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2" class="">public</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> StrideProtocol : </span><span style="font-variant-ligatures:no-common-ligatures" class="">ExpressibleByIntegerLiteral</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> {</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;min-height:15px" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""></span><br class=""></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures" class="">/// 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)" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures" class="">public</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures" class="">static</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> -(x: </span><span style="font-variant-ligatures:no-common-ligatures;color:#703daa" class="">Self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) -> </span><span style="font-variant-ligatures:no-common-ligatures;color:#703daa" class="">Self</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;min-height:15px" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""></span><br class=""></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures" class="">/// Returns the difference between `lhs` and `rhs`.</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2" class="">public</span><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2" class="">static</span><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2" class="">func</span><span style="font-variant-ligatures:no-common-ligatures" class=""> -(lhs: </span><span style="font-variant-ligatures:no-common-ligatures;color:#703daa" class="">Self</span><span style="font-variant-ligatures:no-common-ligatures" class="">, rhs: </span><span style="font-variant-ligatures:no-common-ligatures;color:#703daa" class="">Self</span><span style="font-variant-ligatures:no-common-ligatures" class="">) -> </span><span style="font-variant-ligatures:no-common-ligatures;color:#703daa" class="">Self</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><span style="color:rgb(186,45,162)" class="">public typealias </span></span>SignedNumber <span style="font-variant-ligatures:no-common-ligatures" class="">= </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">StrideProtocol</span><span style="font-variant-ligatures:no-common-ligatures" class=""> & </span><span style="color:rgb(112,61,170);font-variant-ligatures:no-common-ligatures" class="">Comparable</span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin:0px;line-height:normal" class="">Strideable.Stride could then conform to StrideProtocol, allowing groups etc. </div><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class="">WDYT?</div><span class="HOEnZb"><font color="#888888" class=""><div style="margin:0px;line-height:normal" class=""><br class=""></div><div style="margin:0px;line-height:normal" class="">-- Sasha</div><div style="margin:0px;line-height:normal" class=""><br class=""></div></font></span></div><br class="">______________________________<wbr class="">_________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
<br class=""></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></div></body></html>