<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 15, 2014 at 12:00 PM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</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">Because lambdas can be stateful, they are not simple functions.  I see lambdas as a shorthand for writing out a functor.<br>
<div><br></div><div>I would write "Helper" because it is an object of the closure type while the function itself is "operator()".</div></blockquote><div><br></div><div>I agree with your analysis about "what is a lambda", but I'm not sure it really captures the intuitive aspect in a lot of cases. The original thing that got me thinking was a piece of code like this:</div>
<div><br></div><div><div><div>  auto eat = [this](TokenKind K, int AdvancePast = 1){</div><div>    CurKind = K;</div><div>    Buf.advance(AdvancePast);</div><div>  };</div><div>  switch (Buf.peek()) {</div><div>  case ';':</div>
<div>    eat(TokenKind::Semicolon);</div><div>    return;</div></div></div><div><br></div><div>Here the lambda is definitely a verb, as opposed to the helper/Helper scenario which is a noun, and it seems like verbs should be lowercase. One possibility is that lambdas are upper-case or lower-case depending on whether they are verbs or nouns (and cross your fingers that you aren't the person who writes the clang-tidy check for this convention!).</div>
<div><br></div><div>-- Sean ilva</div><div> </div><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"><div class="">
<div class="h5">
<br><div>On Mon Apr 14 2014 at 8:37:14 PM, Duncan Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>> wrote:</div><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">

<br>
> On Apr 14, 2014, at 20:14, Sean Silva <<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>> wrote:<br>
><br>
> Do local lambdas get named like variables or like functions?<br>
><br>
> E.g.<br>
><br>
> void foo() {<br>
>   auto helper = [](...){...};<br>
<br>
It should be "help" here (verb), not "helper" (noun), but this is the direction I like.  It's a local function!<br>
<br>
>   // or<br>
>   auto Helper = [](...){...};<br>
> }<br>
><br>
> My gut is that it should be lowercase (named like a function) since I got a weird feeling in my stomach seeing an upper-case name being called like a function in new code.<br>
><br>
> -- Sean Silva<br>
> ______________________________<u></u>_________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
</blockquote>
</div></div></blockquote></div><br></div></div>