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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 9 15:09:39 PDT 2018


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)

On Thu, Jul 5, 2018 at 12:54 PM Duncan P. N. Exon Smith via Phabricator via
llvm-commits <llvm-commits at lists.llvm.org> wrote:

> dexonsmith created this revision.
>
> I argue we should spell C++ lambdas (and other function-like variables)
> like functions, not like variables.
>
> - Use verbs, not nouns.
> - Use lowerCamelCase.
>
> Thoughts?
>
>
> https://reviews.llvm.org/D48991
>
> Files:
>   llvm/docs/CodingStandards.rst
>
>
> Index: llvm/docs/CodingStandards.rst
> ===================================================================
> --- llvm/docs/CodingStandards.rst
> +++ llvm/docs/CodingStandards.rst
> @@ -1178,6 +1178,9 @@
>    command-like function should be imperative.  The name should be camel
> case,
>    and start with a lower case letter (e.g. ``openFile()`` or ``isFoo()``).
>
> +* **Function-like objects**, such as C++ lambdas and function pointers,
> should
> +  be written like function names.
> +
>  * **Enum declarations** (e.g. ``enum Foo {...}``) are types, so they
> should
>    follow the naming conventions for types.  A common use for enums is as a
>    discriminator for a union, or an indicator of a subclass.  When an enum
> is
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180709/4ac1859f/attachment.html>


More information about the llvm-commits mailing list