<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Antonio,<div class=""><br class=""></div><div class="">This is explicitly mentioned in the original proposal. We do not allow multiple conditional conformances to be defined for the same type. Instead, is it possible to express your conformance as follows?</div><div class=""><br class=""></div><div class="">extension Array : Intertial where Element : Inertial { … }</div><div class=""><br class=""></div><div class="">Or do you really need different algorithms for Element == CGPoint and Element == [CGPoint], with no conformance for Element == [[CGPoint]], etc?</div><div class=""><br class=""></div><div class="">If the latter, you could possibly have an InertialElement protocol or similar that CGPoint and [CGPoint] conform to, with a second level of dispatch to pick between the two cases.</div><div class=""><br class=""></div><div class="">Slava<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 28, 2017, at 12:31 PM, Antonino Ficarra via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class="">I’have a protocol:</span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><span style="color: #ba2da2" class="">protocol</span> Inertial {</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #ba2da2" class="">func</span><span class="Apple-tab-span" style="white-space:pre">        </span>convexHull( <span style="color: #ba2da2" class="">_</span> t:<span style="color: #703daa" class="">AffineTransform</span>? ) -> [<span style="color: #703daa" class="">CGPoint</span>]</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(112, 61, 170); background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><span style="" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #ba2da2" class="">func</span><span style="" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>area( </span><span style="color: #ba2da2" class="">_</span><span style="" class=""> t:</span>AffineTransform<span style="" class="">? ) -> </span>CGFloat</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #ba2da2" class="">func</span><span class="Apple-tab-span" style="white-space:pre">        </span>firstOrderMomentums( <span style="color: #ba2da2" class="">_</span> t:<span style="color: #703daa" class="">AffineTransform</span>? ) -> (x:<span style="color: #703daa" class="">CGFloat</span>,y:<span style="color: #703daa" class="">CGFloat</span>)</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #ba2da2" class="">func</span><span class="Apple-tab-span" style="white-space:pre">        </span>secondOrderMomentums( <span style="color: #ba2da2" class="">_</span> t:<span style="color: #703daa" class="">AffineTransform</span>? ) -> (xx:<span style="color: #703daa" class="">CGFloat</span>,xy:<span style="color: #703daa" class="">CGFloat</span>,yy:<span style="color: #703daa" class="">CGFloat</span>)</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class="">}</span></font></div></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class="">I make [CPoint] (a poligon) conforms to <span style="background-color: rgb(255, 255, 255);" class="">the protocol</span>:</span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><span style="color: #ba2da2" class="">extension</span><span style="" class=""> </span><span style="color: #703daa" class="">Array</span><span style="" class=""> : </span><span style="text-decoration: underline" class="">I</span>nertial<span style="" class=""> </span><span style="color: #ba2da2" class="">where</span><span style="" class=""> </span>Element<span style="" class=""> == </span><span style="color: #703daa" class="">CGPoint</span><span style="" class=""> {</span></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">func</span> convexHull(<span style="color: #ba2da2" class="">_</span> t: <span style="color: #703daa" class="">AffineTransform</span>?) -> [<span style="color: #703daa" class="">CGPoint</span>] {</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">return</span> <span style="color: #4f8187" class="">ConvexHull</span>.<span style="color: #31595d" class="">convexHull</span>( points:<span style="color: #ba2da2" class="">self</span> ).<span style="color: #3e1e81" class="">map</span> { $0 * t }</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> }</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 16px;" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <br class="webkit-block-placeholder"></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(112, 61, 170); background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><span style="" class=""> </span><span style="color: #ba2da2" class="">func</span><span style="" class=""> area(</span><span style="color: #ba2da2" class="">_</span><span style="" class=""> t: </span>AffineTransform<span style="" class="">?) -> </span>CGFloat<span style="" class=""> {</span></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">return</span> <span style="color: #4f8187" class="">InertialUti</span>.<span style="color: #31595d" class="">area</span>( polig: <span style="color: #ba2da2" class="">self</span>,t )</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> }</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 16px;" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <br class="webkit-block-placeholder"></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">func</span> firstOrderMomentums(<span style="color: #ba2da2" class="">_</span> t: <span style="color: #703daa" class="">AffineTransform</span>?) -> (x: <span style="color: #703daa" class="">CGFloat</span>, y: <span style="color: #703daa" class="">CGFloat</span>) {</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">return</span> <span style="color: #4f8187" class="">InertialUti</span>.<span style="color: #31595d" class="">firstOrderMomentums</span>( polig:<span style="color: #ba2da2" class="">self</span>,t )</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> }</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 16px;" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <br class="webkit-block-placeholder"></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">func</span> secondOrderMomentums(<span style="color: #ba2da2" class="">_</span> t: <span style="color: #703daa" class="">AffineTransform</span>?) -> (xx: <span style="color: #703daa" class="">CGFloat</span>, xy: <span style="color: #703daa" class="">CGFloat</span>, yy: <span style="color: #703daa" class="">CGFloat</span>) {</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">return</span> <span style="color: #4f8187" class="">InertialUti</span>.<span style="color: #31595d" class="">secondOrderMomentums</span>( polig:<span style="color: #ba2da2" class="">self</span>,t )</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> }</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class="">}</span></font></div></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class="">and work like a charm.</span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class="">Then I try to make [[CPoint]] (an array of poligon<b class="">s)</b> conforms to <span style="background-color: rgb(255, 255, 255);" class="">the same </span></span></font><span style="font-family: Menlo; font-size: 14px; background-color: rgb(255, 255, 255);" class="">protocol</span><span style="font-size: 14px; font-family: Menlo;" class="">:</span></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><span style="color: #ba2da2" class="">extension</span><span style="" class=""> </span><span style="color: #703daa" class="">Array</span><span style="" class=""> : </span>Inertial<span style="" class=""> </span><span style="color: #ba2da2" class="">where</span><span style="" class=""> </span>Element<span style="" class=""> == [</span><span style="color: #703daa" class="">CGPoint</span><span style="" class="">] {</span></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">var</span> allVertexs : [<span style="color: #703daa" class="">CGPoint</span>] {</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">return</span> <span style="color: #3e1e81" class="">flatMap</span>({$0})</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> }</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 16px;" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <br class="webkit-block-placeholder"></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">func</span> convexHull(<span style="color: #ba2da2" class="">_</span> t: <span style="color: #703daa" class="">AffineTransform</span>?) -> [<span style="color: #703daa" class="">CGPoint</span>] {</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">return</span> <span style="color: #4f8187" class="">ConvexHull</span>.<span style="color: #31595d" class="">convexHull</span>( points:<span style="color: #4f8187" class="">allVertexs</span> ).<span style="color: #3e1e81" class="">map</span> { $0 * t }</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> }</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 16px;" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <br class="webkit-block-placeholder"></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(112, 61, 170); background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><span style="" class=""> </span><span style="color: #ba2da2" class="">func</span><span style="" class=""> area(</span><span style="color: #ba2da2" class="">_</span><span style="" class=""> t: </span>AffineTransform<span style="" class="">?) -> </span>CGFloat<span style="" class=""> {</span></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">return</span> <span style="color: #4f8187" class="">InertialUti</span>.<span style="color: #31595d" class="">area</span>( poligs: <span style="color: #ba2da2" class="">self</span>,t )</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> }</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 16px;" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <br class="webkit-block-placeholder"></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">func</span> firstOrderMomentums(<span style="color: #ba2da2" class="">_</span> t: <span style="color: #703daa" class="">AffineTransform</span>?) -> (x: <span style="color: #703daa" class="">CGFloat</span>, y: <span style="color: #703daa" class="">CGFloat</span>) {</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">return</span> <span style="color: #4f8187" class="">InertialUti</span>.<span style="color: #31595d" class="">firstOrderMomentums</span>( poligs:<span style="color: #ba2da2" class="">self</span>,t )</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> }</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 16px;" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <br class="webkit-block-placeholder"></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">func</span> secondOrderMomentums(<span style="color: #ba2da2" class="">_</span> t: <span style="color: #703daa" class="">AffineTransform</span>?) -> (xx: <span style="color: #703daa" class="">CGFloat</span>, xy: <span style="color: #703daa" class="">CGFloat</span>, yy: <span style="color: #703daa" class="">CGFloat</span>) {</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> <span style="color: #ba2da2" class="">return</span> <span style="color: #4f8187" class="">InertialUti</span>.<span style="color: #31595d" class="">secondOrderMomentums</span>( poligs:<span style="color: #ba2da2" class="">self</span>,t )</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> }</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class="">}</span></font></div></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class="">but this isn’t permitted: Redundant conformance of 'Array<Element>' to protocol ‘Inertial’ !</span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class="">I think it's a severe limitation: a</span></font><span style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class="">rray with different element’s type</span></font></span><span style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""> (i.e. different specializations of the same generic type) should be treated as distinct types and not as the same type.</span></font></span></div></div><div class=""><br class=""></div><div class=""><div class=""><br class=""></div></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><br class=""></div></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></div></body></html>