I argue we should spell C++ lambdas (and other function-like variables) like functions, not like variables.
Use verbs, not nouns.
I think I agree with this.
Use lowerCamelCase.
In lld we use UpperCamelCase, as they are technically not function names but variable names. Using lowerCamelCase for function pointers feels really weird to me, as they are really variables than functions to me.
Makes sense to me, I think that all callable values could be named in the same approach, including function references and std::functions? Function pointers are not callable (you need to dereference them) so it is arguable that they should be capitalized. It would be nice to include some rationale of why you’re picking one thing or another in coding standard paragraph.
That seems a bit more awkward/not-clearly-good to me (though I do appreciate that the standard C++ naming convention, for all that it doesn’t really differentiate between anything (except macros) by having everything lower_case, does use the same convention between variables and functions so you don’t get that disconnect) - ending up with function-named variables that don’t behave like functions (get used in assignments, have member functions called on them, compared to nullptr (weak functions notwithstanding), etc).
Seems more like a narrow kind of hungarian notation to me - to designate that this variable can be called. Which doesn’t seem important enough to callout with a separate naming convention.
But I’m not too fussed about it if others feel strongly.
I wrote that I prefer CamelCase over camelCase for callable objects, but I don’t have a strong opinion. If the majority prefers camelCase, I’m happy to update the existing lld’s code to conform to the new coding style.
What about situations where a function is a parameter:
template <typename Func> void fred(int Arg, Func Do) {...}
If we use lowercase names for the function parameters it is going to look awful.
FWIW I would prefer to name them like variables too. Since being callable is their raison d’etre I’m unlikely to forget to use them that way. On the other hand, naming them like variables is a subtle but helpful reminder that they can be assigned to, moved from, may be default constructed (and so in a not-callable state), etc.