<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=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 15, 2018, at 4:31 PM, Karl Wagner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><div class=""><div style="caret-color: rgb(0, 0, 0); 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; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class=""><blockquote type="cite" class=""><div class="">On 14. Jan 2018, at 21:12, Kelvin Ma via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">This could work, but you’re also giving up all the nice Numeric and FloatingPoint conformances when you use this,, all of a sudden adding two angles together isn’t let<span class="Apple-converted-space">&nbsp;</span><span class="" style="font-family: monospace, monospace;">γ = α + β</span>, it’s<span class="Apple-converted-space">&nbsp;</span><span class="" style="font-family: monospace, monospace;">γ = Angle.radians(α.radians + β.radians)</span>. just no. at the risk of blowing up the scope of this idea, dedicated<span class="Apple-converted-space">&nbsp;</span><span class="" style="font-family: monospace, monospace;">Angle</span><span class="Apple-converted-space">&nbsp;</span>types also begs for generic trigonometric functions like<span class="Apple-converted-space">&nbsp;</span><span class="" style="font-family: monospace, monospace;">Angle.sin(_:)</span><span class="Apple-converted-space">&nbsp;</span>and<span class="Apple-converted-space">&nbsp;</span><span class="" style="font-family: monospace, monospace;">Angle.cos(_:)</span>. i proposed that a while back and even tried implementing it but fast trig evaluation doesn’t genericize well since it relies a lot on<span class="Apple-converted-space">&nbsp;</span><span class="" style="font-family: monospace, monospace;">rsqrt</span>-style magic constants<br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">You could add those conformances back, if you wanted. Most low-level trig code will quickly escape the wrapper once it starts using the values. Mostly I use it as a currency type and for converting untyped angles. I think it’s a great example of Swift’s zero-cost abstractions - we added semantic meaning (this value isn’t just a number with a specific bit representation, it’s a number which represents a specific kind of quantity), and encapsulated some useful functionality, and we don't lose any performance.</div></div></div></blockquote><br class=""></div><div>And in fact you probably don’t want that conformance. It makes sense dimensionally to add two angles. It doesn’t (generally) make as much sense to multiply them, or to take the square root of an angle. I would expect an angle type to provide + and - but probably not * and / and most of the other floating-point operations.</div><div><br class=""></div><div>– Steve</div></body></html>