[PATCH] D48991: Docs: Spell C++ lambdas like functions, not variables

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 10 16:23:15 PDT 2018


dexonsmith added a comment.

In https://reviews.llvm.org/D48991#1156565, @dblaikie wrote:

> Only lambdas, and not other functors (like std::function, etc)?
>
> So we could end up with code like:
>
> MyFunctor = myLambda;
>
> Though I suppose that's OK - and it's only in the local scope of a function
>  & not like any interesting object-like operations (such as assignment) can
>  be done with the lambda as the subject anyway, so it does look a lot like a
>  function... (except you can't assign it to a function pointer - but at
>  least the lambda should be nearby in the code so that's not too confusing)


I was just about to commit this (with an example), then I saw your comment which I had missed.  The idea would actually be:

  myFunctor = myLambda;

Essentially, objects primarily used as callable things would be spelled like functions.

Would you rather carve out lambdas specifically?


https://reviews.llvm.org/D48991





More information about the llvm-commits mailing list