<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 2, 2016 at 7:59 PM, Dave Abrahams via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><br>
on Tue Feb 02 2016, Jordan Rose <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
<br>
>> On Feb 2, 2016, at 17:28, David Owens II via swift-evolution<br>
>> <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
>><br>
>><br>
>>> On Feb 2, 2016, at 4:54 PM, Dave Abrahams via swift-evolution<br>
><br>
>>> <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
</span>>>> <mailto:<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>><br>
<div><div class="h5">>>> wrote:<br>
>>><br>
>>>> Similarly,<br>
>>>><br>
>>>> let content = listItemView.text.trimming(characters: .whitespaceAndNewlines)<br>
>>>><br>
>>>> At least I have some context at the call site what the purpose of<br>
>>>> .whitespaceAndNewlines.<br>
>>><br>
>>> You wouldn't say "go to the garden and trim the plant: rhododendrons".<br>
>>> It isn't necessary for comprehension. Why do you feel characters: is<br>
>>> necessary here?<br>
>><br>
>> Because unlike the English phrase, "trimming" does not have an<br>
>> implicit object set based on the context of a string; what else<br>
>> would you typically trim in a garden other than plant life? I could<br>
>> naturally create an API that allows trimming by a line range or<br>
>> string content, as an example.<br>
>><br>
>> "public func foo() {}".trimmed(text: "public ")<br>
>> longContentWithKnownPreamble.trimmed(lines: 0..<5)<br>
>><br>
>> We could make these different APIs as opposed to overloads, though<br>
>> I'm not convinced that they are not simply different ways to trim<br>
>> content.<br>
><br>
> That's actually why this one is "trimming", not "trimmed". "trimming"<br>
> allows a direct object; "trimmed" does not.<br>
><br>
> I don't really have a problem with this overload set, although<br>
> admittedly I can't tell if we're trimming prefixes, suffixes, or both,<br>
> and I would hope that's consistent between the two.<br>
><br>
> inputText.trimming(.whitespaceAndNewlines)<br>
> inputText.trimming("public ")<br>
><br>
> These are both perfectly good noun phrases in English, too: "[get me]<br>
> the inputText, trimming whitespace and newlines" and "[get me] the<br>
> inputText, trimming 'public '".<br>
><br>
> (But to play David's Advocate, it also seems perfectly reasonable in<br>
> English to say "[get me] the inputText, trimming whitespace and<br>
> newline characters" and "[get me] the inputText, trimming the string<br>
> 'public '".)<br>
<br>
</div></div>Back to Strunk & White. Yes, people often use more words than<br>
necessary, so it sounds normal. These two aren't so bad, but it's death<br>
by a thousand cuts.<div class=""><div class="h5"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank"></a></div></div></blockquote><div><br></div><div><span style="font-size:13px">And now it'll be death by a thousand command-clicks. :) </span> </div></div><br></div></div>