<div dir="ltr">Oops, +cfe-dev for more opinions.<br>Original message:<br><div class="gmail_quote"><div dir="ltr">On Thu, May 24, 2018 at 12:19 PM Sam McCall <<a href="mailto:sammccall@google.com">sammccall@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The coding guidelines say:<div>> Function names should be verb phrases (as they represent actions), and command-like function should be imperative. The name should be camel case, and start with a lower case letter (e.g. openFile() or isFoo()).</div><div><br></div><div>This means that functions that just compute or access a value (no side-effects) should be named e.g. `getParent()`, rather than `parent()` as they are in e.g. the standard library.</div><div><br></div><div>This is not a rule that is particularly strictly observed in practice :-)</div><div>Personally I find it adds noise and obscures the important difference between functions called mostly for their side-effects and those called to get at a value.</div><div><br></div><div>Swift's coding guidelines state this quite concisely:</div><div>> Name functions and methods according to their side-effects</div><div>> Those without side-effects should read as noun phrases, e.g. x.distance(to: y), i.successor().<br></div><div>> Those with side-effects should read as imperative verb phrases, e.g., print(x), x.sort(), x.append(y).</div><div>(<a href="https://swift.org/documentation/api-design-guidelines/#strive-for-fluent-usage" target="_blank">https://swift.org/documentation/api-design-guidelines/#strive-for-fluent-usage</a>)</div><div><br></div><div>How do people feel about this change? Clearly a mix of these styles will exist in practice for a long time (this is already the case!) but which should be encouraged?</div><div><br></div><div>(*dons flame-retardant suit and mumbles something about Java*)</div></div></blockquote><div><br></div><div><div dir="ltr" style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br class="gmail-Apple-interchange-newline">On Thu, May 24, 2018 at 4:42 PM Dean Michael Berris via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:</div><blockquote class="gmail_quote" style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> On 25 May 2018, at 00:14, Nicolai Hähnle via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" style="color:rgb(17,85,204)">llvm-dev@lists.llvm.org</a>> wrote:<br>> On 24.05.2018 13:11, Dean Michael Berris via llvm-dev wrote:<br>>> I like it, but only if this means we’re going to introduce churn for the public interfaces. I’m not sure this is actually worth the trouble to do, but more consistent rules just sound like better rules to me at least.<br>><span> </span><br>> I assume there is a "not" missing in the first sentence there?<br><br>Oh my, yes you’re right — I meant “only if it means we’re *not* going to introduce churn for the public interfaces”.<br><br>> I'd also prefer not to have API churn just for the sake of minor stylistic issues.<br></blockquote><div style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">(Also agree with this FWIW) </div> </div></div></div>