<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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 Feb 2, 2016, at 4:54 PM, Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div></blockquote><blockquote type="cite" class=""><div class=""><div class=""><br class=""><blockquote type="cite" class="">The following version of the API is significantly more clear with no<br class="">requirement of the variable names to be matched to the expectations of<br class="">the API signature:<br class=""><br class="">let next = current.updating(proximity: p)<br class=""></blockquote><br class="">Either of these, IMO, clarify that API much better:<br class=""><br class=""> let next = current.replacingProximityWith(p)<br class=""> let next = current.settingProximityTo(p)<br class=""><br class="">but so what? The example started with a poor API; there are any number<br class="">of things one could do to improve it.<br class=""></div></div></blockquote><div><br class=""></div><div>The point was to highlight that the clarity should be coming from the API, not the inputs to the API.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""><blockquote type="cite" class="">Similarly,<br class=""><br class="">let content = listItemView.text.trimming(characters: .whitespaceAndNewlines)<br class=""><br class="">At least I have some context at the call site what the purpose of<br class="">.whitespaceAndNewlines.<br class=""></blockquote><br class="">You wouldn't say "go to the garden and trim the plant: rhododendrons".<br class="">It isn't necessary for comprehension. Why do you feel characters: is<br class="">necessary here?<br class=""></div></div></blockquote><div><br class=""></div><div>Because unlike the English phrase, "trimming" does not have an implicit object set based on the context of a string; what else would you typically trim in a garden other than plant life? I could naturally create an API that allows trimming by a line range or string content, as an example.</div><div><br class=""></div></div><div><div><font face="Menlo" class="">"public func foo() {}".trimmed(text: "public ")</font></div><div><font face="Menlo" class="">longContentWithKnownPreamble.trimmed(lines: 0..<5)</font></div></div><div><div><br class=""></div><div>We could make these different APIs as opposed to overloads, though I'm not convinced that they are not simply different ways to trim content.</div><div><br class=""></div></div>-David</body></html>