<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">+1000 to this.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 31, 2017, at 11:22 AM, Hooman Mehr 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Maybe we need more than one level of standard library: The core (which is most of what we have now (but maybe not all of it) and multiple opt-in standard modules for hash functions, math, specialized data structures, etc.</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 31, 2017, at 11:10 AM, Taylor Swift &lt;<a href="mailto:kelvin13ma@gmail.com" class="">kelvin13ma@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I’m not sure why only the stdlib is inlineable and specializable, but I believe it has something to do with ABI. I’m not an ABI expert though. I strongly disagree that a Swift Math library should be delegated to a third party. Math is “common” enough that there should really only be one “standard” implementation of it, under the direction of the Swift Project; we don’t want 5 competing third party Vector standards.<br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Jul 31, 2017 at 2:02 PM, Hooman Mehr <span dir="ltr" class="">&lt;<a href="mailto:hooman@mac.com" target="_blank" class="">hooman@mac.com</a>&gt;</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="">I know. I hear you. I have some special arrangmnents to keep such things manageable, and I am not happy about how things stand right now.<div class=""><br class=""></div><div class="">What I am hoping to open up&nbsp;stdlib&nbsp;special compiler mode to other (low-level) libraries and also letting such libraries gain optimizations similar to stdlib when included in a project.<div class=""><br class=""></div><div class="">So, instead of putting things in&nbsp;stdlib, I want stdlib’s special privileges being made available to a certain category of third-party or internal modules.<div class=""><div class="h5"><br class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 31, 2017, at 10:54 AM, Taylor Swift &lt;<a href="mailto:kelvin13ma@gmail.com" target="_blank" class="">kelvin13ma@gmail.com</a>&gt; wrote:</div><br class="m_204244033810488435Apple-interchange-newline"><div class=""><div dir="ltr" class="">Isn’t the point of standard inlineable library module to prevent the need to copy and paste code like this into every project? Currently I have a “math.swift” file I copy and paste into all of my projects, and since I occasionally update it, there exists about 15 different versions of it floating around, so I know this is not a sustainable practice.<br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Jul 31, 2017 at 1:45 PM, Hooman Mehr <span dir="ltr" class="">&lt;<a href="mailto:hooman@mac.com" target="_blank" class="">hooman@mac.com</a>&gt;</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="">I prefer an approach that preserves how I am used to seeing math expressions. I use this myself:<div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;background-color:rgb(255,255,255)" class=""><div style="margin:0px;line-height:normal" class=""><span style="color:#ba2da2" class="">protocol</span> FloatingPointMath: <span style="color:#703daa" class="">FloatingPoint</span></div><div style="margin:0px;line-height:normal" class="">{</div><div style="margin:0px;line-height:normal" class="">&nbsp; &nbsp; <span style="color:#ba2da2" class="">static</span> <span style="color:#ba2da2" class="">func</span> sqrt(<span style="color:#ba2da2" class="">_</span> value: <span style="color:#4f8187" class="">Self</span>) -&gt; <span style="color:#703daa" class="">Self</span></div><div style="margin:0px;font-size:12px;line-height:normal;min-height:14px" class=""><br class=""></div><div style="margin:0px;line-height:normal" class="">&nbsp; &nbsp; <span style="color:#ba2da2" class="">static</span> <span style="color:#ba2da2" class="">func</span> sin(<span style="color:#ba2da2" class="">_</span> value: <span style="color:#4f8187" class="">Self</span>) -&gt; <span style="color:#703daa" class="">Self</span></div><div style="margin:0px;line-height:normal" class="">&nbsp; &nbsp; <span style="color:#ba2da2" class="">static</span> <span style="color:#ba2da2" class="">func</span> cos(<span style="color:#ba2da2" class="">_</span> value: <span style="color:#4f8187" class="">Self</span>) -&gt; <span style="color:#703daa" class="">Self</span></div><div style="margin:0px;line-height:normal" class="">&nbsp; &nbsp; <span style="color:#ba2da2" class="">static</span> <span style="color:#ba2da2" class="">func</span> tan(<span style="color:#ba2da2" class="">_</span> value: <span style="color:#4f8187" class="">Self</span>) -&gt; <span style="color:#703daa" class="">Self</span></div><div style="margin:0px;line-height:normal" class="">&nbsp; &nbsp; <span style="color:#ba2da2" class="">static</span> <span style="color:#ba2da2" class="">func</span> asin(<span style="color:#ba2da2" class="">_</span> value: <span style="color:#4f8187" class="">Self</span>) -&gt; <span style="color:#703daa" class="">Self</span></div><div style="margin:0px;line-height:normal" class="">&nbsp; &nbsp; <span style="color:#ba2da2" class="">static</span> <span style="color:#ba2da2" class="">func</span> acos(<span style="color:#ba2da2" class="">_</span> value: <span style="color:#4f8187" class="">Self</span>) -&gt; <span style="color:#703daa" class="">Self</span></div><div style="margin:0px;line-height:normal" class="">&nbsp; &nbsp; <span style="color:#ba2da2" class="">static</span> <span style="color:#ba2da2" class="">func</span> atan(<span style="color:#ba2da2" class="">_</span> value: <span style="color:#4f8187" class="">Self</span>) -&gt; <span style="color:#703daa" class="">Self</span></div><div style="margin:0px;line-height:normal;min-height:13px" class="">&nbsp;&nbsp; &nbsp;<br class="m_204244033810488435m_5301210826314882459webkit-block-placeholder"></div><div style="margin:0px;line-height:normal" class="">&nbsp; &nbsp; <span style="color:#ba2da2" class="">static</span> <span style="color:#ba2da2" class="">func</span> ln(<span style="color:#ba2da2" class="">_</span> value: <span style="color:#4f8187" class="">Self</span>) -&gt; <span style="color:#703daa" class="">Self</span></div><div style="margin:0px;line-height:normal" class="">&nbsp; &nbsp; <span style="color:#ba2da2" class="">static</span> <span style="color:#ba2da2" class="">func</span> log(<span style="color:#ba2da2" class="">_</span> value: <span style="color:#4f8187" class="">Self</span>, base: <span style="color:#4f8187" class="">Self</span>) -&gt; <span style="color:#703daa" class="">Self</span></div><div style="margin:0px;line-height:normal" class="">&nbsp; &nbsp; <span style="color:#ba2da2" class="">static</span> <span style="color:#ba2da2" class="">func</span> pow(<span style="color:#ba2da2" class="">_</span> value: <span style="color:#4f8187" class="">Self</span>, exponent:<span style="color:#4f8187" class="">Self</span>) -&gt; <span style="color:#703daa" class="">Self</span></div><div style="margin:0px;line-height:normal" class="">&nbsp; &nbsp; <span style="color:#ba2da2" class="">static</span> <span style="color:#ba2da2" class="">func</span> exp(<span style="color:#ba2da2" class="">_</span> value: <span style="color:#4f8187" class="">Self</span>) -&gt; <span style="color:#703daa" class="">Self</span></div><div style="margin:0px;line-height:normal" class="">}</div><div class=""><br class=""></div></div></div><div class="">It does not pollute the global namespace and gives nice contextual auto-completion.&nbsp; And I don’t want it in the standard library: I only add the file when I need it. (it is not a separate module for optimization reasons).</div><div class=""><div class="m_204244033810488435h5"><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 31, 2017, at 10:29 AM, Taylor Swift via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_204244033810488435m_5301210826314882459Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Jul 31, 2017 at 1:23 PM, Adrian Zubarev <span dir="ltr" class="">&lt;<a href="mailto:adrian.zubarev@devandartist.com" target="_blank" class="">adrian.zubarev@devandartist.c<wbr class="">om</a>&gt;</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=""><div id="m_204244033810488435m_5301210826314882459m_-5678978844789218338bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;margin:0px" class="">I’m not sure how I would feel about this. To be honest I’d avoid such additional changes from the stdlib, because they really don’t belong there. Instead some `Math` module/package would be a better fit than clustering everything into stdlib until we end up also adding UI stuff.</div> <div class=""><br class=""></div>Furthermore, I don’t think a function would make any sense here. It really should be a computed property.<div class=""><div class="m_204244033810488435m_5301210826314882459h5"><br class=""> <div id="m_204244033810488435m_5301210826314882459m_-5678978844789218338bloop_sign_1501521568263739136" class="m_204244033810488435m_5301210826314882459m_-5678978844789218338bloop_sign"></div> <br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">I think a standard Math module would be a good idea, but only if it benefits from the same inlining and specialization as the standard library. Also squareRoot() should be moved to the Math module if it is ever created.<br class=""></div><div class="">&nbsp;</div><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=""><div class=""><div class="m_204244033810488435m_5301210826314882459h5"><p class="m_204244033810488435m_5301210826314882459m_-5678978844789218338airmail_on">Am 31. Juli 2017 um 19:03:49, Taylor Swift via swift-evolution (<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>) schrieb:</p> </div></div><blockquote type="cite" class="m_204244033810488435m_5301210826314882459m_-5678978844789218338clean_bq"><span class=""><div class=""><div class=""></div><div class=""><div class=""><div class="m_204244033810488435m_5301210826314882459h5">





<div dir="ltr" class="">
<div class="">How would people feel about adding a protocol<br class="">
<br class="">
<span style="font-family:monospace,monospace" class="">protocol
MathFloatingPoint:FloatingPoin<wbr class="">t<br class="">
{<br class="">
&nbsp;&nbsp;&nbsp; func sin() -&gt; Self<br class="">
&nbsp;&nbsp;&nbsp; func cos() -&gt; Self<br class="">
&nbsp;&nbsp;&nbsp; func tan() -&gt; Self<br class="">
&nbsp;&nbsp;&nbsp; func asin() -&gt; Self<br class="">
&nbsp;&nbsp;&nbsp; func acos() -&gt; Self<br class="">
&nbsp;&nbsp;&nbsp; func atan() -&gt; Self<br class="">
<br class=""></span></div>
<div class=""><span style="font-family:monospace,monospace" class="">&nbsp;&nbsp;&nbsp; func ln()
-&gt; Self<br class=""></span></div>
<div class=""><span style="font-family:monospace,monospace" class="">&nbsp;&nbsp;&nbsp; func
log(base:Self) -&gt; Self<br class=""></span></div>
<div class=""><span style="font-family:monospace,monospace" class="">&nbsp;&nbsp;&nbsp; func
pow(exponent:Self) -&gt; Self<br class=""></span></div>
<div class=""><span style="font-family:monospace,monospace" class="">&nbsp;&nbsp;&nbsp; func exp()
-&gt; Self<br class=""></span></div>
<div class=""><span style="font-family:monospace,monospace" class="">}</span><br class="">
<br class=""></div>
to the standard library? Float and Double would then be made to
conform by default using Swift implementations instead of having to
import Glibc / Darwin and writing the extensions, depending on
platform.<br class=""></div></div></div><span class="">


______________________________<wbr class="">_________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailma<wbr class="">n/listinfo/swift-evolution</a><br class=""></span></div></div></span></blockquote></div></blockquote></div><br class=""></div></div>
______________________________<wbr class="">_________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailma<wbr class="">n/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></div></div></div></div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>