<html><body 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="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #ba2da2" class="">func</span><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>area( </span><span style="color: #ba2da2" class="">_</span><span style="color: #000000" class=""> t:</span>AffineTransform<span style="color: #000000" 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="color: #000000" class=""> </span><span style="color: #703daa" class="">Array</span><span style="color: #000000" class=""> : </span><span style="text-decoration: underline" class="">I</span>nertial<span style="color: #000000" class=""> </span><span style="color: #ba2da2" class="">where</span><span style="color: #000000" class=""> </span>Element<span style="color: #000000" class=""> == </span><span style="color: #703daa" class="">CGPoint</span><span style="color: #000000" 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><p 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></p><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="color: #000000" class=""> </span><span style="color: #ba2da2" class="">func</span><span style="color: #000000" class=""> area(</span><span style="color: #ba2da2" class="">_</span><span style="color: #000000" class=""> t: </span>AffineTransform<span style="color: #000000" class="">?) -> </span>CGFloat<span style="color: #000000" 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><p 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></p><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><p 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></p><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="color: #000000" class=""> </span><span style="color: #703daa" class="">Array</span><span style="color: #000000" class=""> : </span>Inertial<span style="color: #000000" class=""> </span><span style="color: #ba2da2" class="">where</span><span style="color: #000000" class=""> </span>Element<span style="color: #000000" class=""> == [</span><span style="color: #703daa" class="">CGPoint</span><span style="color: #000000" 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><p 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></p><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><p 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></p><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="color: #000000" class=""> </span><span style="color: #ba2da2" class="">func</span><span style="color: #000000" class=""> area(</span><span style="color: #ba2da2" class="">_</span><span style="color: #000000" class=""> t: </span>AffineTransform<span style="color: #000000" class="">?) -> </span>CGFloat<span style="color: #000000" 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><p 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></p><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><p 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></p><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></body></html>