<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On 2 May 2017, at 2:33 pm, Xiaodi Wu 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="">On Mon, May 1, 2017 at 11:22 PM, T.J. Usiyan <span dir="ltr" class="">&lt;<a href="mailto:griotspeak@gmail.com" target="_blank" class="">griotspeak@gmail.com</a>&gt;</span> wrote:<br class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="">Xi: "Does this gain something by being part of the standard library?"<div class="">Me: "<span style="font-size:12.800000190734863px" class="">This gains discoverability and standardization by being part of the standard library."</span></div><div class=""><span style="font-size:12.800000190734863px" class="">Xi: "</span><span style="font-size:12.800000190734863px" class="">By definition, if it's in the standard library, it becomes standardized and discoverable.</span><span style="font-size:12.800000190734863px" class="">"</span></div><div class=""><span style="font-size:12.800000190734863px" class=""><br class=""></span></div><div class=""><span style="font-size:12.800000190734863px" class="">We're in agreement, then?</span></div></div></blockquote><div class=""><br class=""></div><div class="">No, you're missing the point entirely. Again, _anything_ gains "discoverability and standardization" by being included as part of the standard library. However, the standard library is deliberately small and is intended to stay that way. So, what should be in and what should be out? The question is: does this feature gain something by being part of the standard library which other features that are deliberately excluded (like left pad) do not?</div></div></div></div></div></blockquote><div><br class=""></div><div>I’m going to back Xiaodi on this one. The standard library is the standard for the language, by definition. That comes with some great things, and some concerning things.</div><div><br class=""></div><div>If we decided anything that was generic and useful as a basis for programming got in, we wouldn’t call it the “Standard Library” - it would be the Kitchen Sink Library. It would be huge. The bar has to be set higher for the library.</div><div><br class=""></div><div>Why is the current repeat functionality in there? Because Strings use it. Why is it public? Because, like you, people noticed it and said “That’s great generic functionality, why not expose it, and let everyone use it?” But that isn’t the bar for adding things: the bar is far higher for them to be added. Especially now as we’re trying to mature Swift from it’s immature fast-moving state. This may be the bar for *exposing* generic things, but the higher bar of “is this core?” may not be met with this proposal.</div><div><br class=""></div><div>Don’t get me wrong, I think it’s a great idea. I just am not sure it meets the bar of “core”.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class="">Repeating a collection endlessly is a useful ability.</div></div></blockquote><div class=""><br class=""></div><div class="">I don't doubt it. Is your argument that any useful and commonly used feature should be part of the standard library? That's simply not the stated criteria for inclusion in the standard library. Hence, why Foundation exists outside of it. There's no point in debating these criteria, as (afaict) that's not up for debate. Again, I don't make the rules. I'm just saying they exist, and I'm arguing that we should abide by them.</div><div class="">&nbsp;</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class="">Yes, it can be written on top of the standard library. It would be generally nice not to require that *especially* when we can repeat single elements without similar effort. The asymmetry is awkward to remember for newbies and awkward to explain away &nbsp;with "we want a focused library so… the Thing A stays but this logically related Thing B can't be in even though showing you the ability to do A does tend to lead you to ask after Thing B."</div><div class=""><div class="gmail-h5"><div class=""><br class=""></div><div class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, May 1, 2017 at 11:55 PM, Xiaodi Wu <span dir="ltr" class="">&lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">That's a tautological argument, though. By definition, if it's in the standard library, it becomes standardized and discoverable. This isn't at all a limiting principle for what goes into the library and what doesn't.<br class=""><br class="">And as I said, there are many commonly useful facilities that aren't part of the standard library, by design and not by oversight. Left pad is one of them.<br class=""><br class="">I'm trying to tease out whether this particular proposal meets the current bar for inclusion. If you believe left pad should be included, your beef is with the deliberate choice to have a small standard library, which as far as I know is not up for reconsideration.<div class="gmail-m_4026030989852958446gmail-HOEnZb"><div class="gmail-m_4026030989852958446gmail-h5"><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Mon, May 1, 2017 at 22:41 T.J. Usiyan &lt;<a href="mailto:griotspeak@gmail.com" target="_blank" class="">griotspeak@gmail.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="">This gains discoverability and standardization by being part of the standard library. New folks would not have to import some library or roll their own to get this reasonable to expect/hope or hope for functionality. Perhaps removing the old function isn't going to work but repeating collections is definitely something useful.<div class=""><br class=""></div><div class="">Left padding for strings would be nice as well, but that is neither here nor there.&nbsp;</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">On Mon, May 1, 2017 at 11:29 PM, Xiaodi Wu via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><span class="">On Mon, May 1, 2017 at 9:52 PM, Karl Wagner <span dir="ltr" class="">&lt;<a href="mailto:razielim@gmail.com" target="_blank" class="">razielim@gmail.com</a>&gt;</span> wrote:<br class=""></span><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail-m_4026030989852958446gmail-m_484438773169830509m_-1556577179268730800m_-3620511031778836470gmail-"><br class="">
&gt; On 2 May 2017, at 04:44, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>&gt; wrote:<br class="">
&gt;<br class="">
&gt; Does this gain something by being part of the standard library as opposed to being built on top of it?<br class="">
<br class="">
</span>Well, somebody thought repeatElement&lt;T&gt; was general enough to make part of the standard library. If we’re going to allow repeating a single item as a Collection, we might as well allow generalise it to repeating any Collection in a loop (including a CollectionOfOne, which is the existing use-case).<br class=""></blockquote><div class=""><br class=""></div></span><div class="">That doesn't answer the question, though: does the feature you propose--repeating any instance of Collection in a loop--gain anything by being a part of the standard library rather than an extension to it?</div><div class=""><br class=""></div><div class="">There are _many_ useful algorithms that can be implemented on top of the standard library and can be of general use; nonetheless, they aren't a part of the standard library. IIUC, it's not because people just haven't had the time to flesh it out; rather, it is a deliberate choice to have a small, narrowly focused standard library. The philosophy, as I understand it, is to make it convenient for users to roll their own conveniences rather than providing all the bits and bobs in the library itself.</div><div class=""><br class=""></div><div class="">One of the points of differentiation between standard library and Foundation is said to be whether something is necessary to support a core language feature, in which case it goes into the standard library. As a consequence, there are less commonly used parts of the standard library which are there because they support other (decidedly not esoteric) parts of the standard library and also happen to have some plausible public uses. Taking a quick look into the repository, for instance, `repeatElement` is used in the implementation of `UnicodeScalar`. However, just because someone determined that `repeatElement` is worth making a public API (since it's going to be in the standard library whether or not it's public), doesn't _automatically_ mean that a generalization of it should be included in the library as well.</div><span class=""><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
Personally, I usually want to repeat a collection of things far more often than I want to repeat an individual thing. It annoys me that the standard library only provides the one I almost never need.<br class=""></blockquote><div class=""><br class=""></div></span><div class="">There are many facilities that the standard library does not provide. Heck, we don't even have left padding for strings! (JavaScript reference, for those following along.) Is there something about this particular feature that makes its not being a part of the standard library uniquely problematic?</div><span class=""><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
Additionally, it could help remove the top-level “repeatElement” function, which I know irritates some people who would rather us not have any top-level functions in the standard library.<br class=""></blockquote><div class=""><br class=""></div></span><div class="">With source stability as a goal, the bar for removal isn't "irritates some people." I actively use this function and there's no justification at all for breaking it. Frankly, I cannot see removal of top-level functions simply because they are top-level to be in scope essentially ever. So let's subset that out of this discussion.</div><div class=""><br class=""></div></div></div></div>
<br class=""></blockquote></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">______________________________<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" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailma<wbr class="">n/listinfo/swift-evolution</a><br class="">
<br class=""></blockquote></div></div></blockquote></div>
</div></div></blockquote></div><br class=""></div></div></div></div></div></div>
</blockquote></div><br class=""></div></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=""></body></html>