<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 23, 2017 at 7:08 PM, Xiaodi Wu <span dir="ltr"><<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br><div class="gmail_quote"><div><div class="h5"><div dir="auto">On Thu, Nov 23, 2017 at 16:45 Kelvin Ma via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 23, 2017 at 12:32 PM, Tino Heth <span><<a href="mailto:2th@gmx.de" target="_blank">2th@gmx.de</a>></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;line-break:after-white-space"><div><span><br><blockquote type="cite"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">a good idea on paper, a disastrous one in practice. What happens if every geometry library declares their own Point type?</div></div></blockquote></span>That would be ugly („disastrous“ imho is a little bit to strong — C++ had/has similar issues, and other languages as well)</div><div>But if there would be a simple Point struct in a library that is popular (could be achieved by shipping it alongside the stdlib), this problem would be solved (there has been a pitch lately, but I guess it faded away silently).</div></div></blockquote></div></div><div class="gmail_extra"><br></div></div><div><div class="gmail_extra">it’s ugly in C++ and disastrous in Swift because C++ has fixed layout guarantees and everyone agrees that z comes after y comes after x, so you can unsafe-bitcast the foreign C++ points into your own points “for free”. you can’t do the same thing in Swift</div></div></blockquote><div dir="auto"><br></div></div></div><div dir="auto">Why do you need to have this ability to unsafe bitcast? Is interconversion between point types such a common operation that it's a performance bottleneck?</div></div></div>
</blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">idk if it’s a performance bottleneck because i use tuples in my geometry stack and i keep the bottom 2 levels in the same module but it cannot be good. a lot of the geometry code I write sits atop 2 or 3 other layers of geometry code beneath it, and it interops with geometry APIs in other libraries. for example it might be organized like <br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><span style="font-family:monospace,monospace">[ Client geometry code ] ←→ [ Library geometry code ] (example: Voronoi.voronoi(_:), Noise.perlin(_:_:))<br></span></div><div class="gmail_extra"><span style="font-family:monospace,monospace"> [ Procedurally generated geometry ] (example: makeSphere(resolution:))<br></span></div><div class="gmail_extra"><span style="font-family:monospace,monospace"> [ Matrices and projections ] (example: Geometry.clockwise(_:_:center:normal:))<br></span></div><div class="gmail_extra"><span style="font-family:monospace,monospace"> [ Math ] (example: Math.cross(_:_:))</span></div><div class="gmail_extra"><br></div><div class="gmail_extra">converting at every boundary seems like something to avoid. not to mention the sheer amount of boilerplate all those conversions produce.<br></div></div>