Duncan P. N. Exon Smith via llvm-dev
2018-Jul-10 23:21 UTC
[llvm-dev] RFC: should we spell lambdas like functions?
> On Jul. 5, 2018, at 18:12, Bruce Hoult via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > > > On Thu, Jul 5, 2018 at 5:30 PM, Adrian Prantl via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > > > > On Jul 5, 2018, at 1:09 PM, Rui Ueyama via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > > > >> On Thu, Jul 5, 2018 at 12:57 PM Duncan P. N. Exon Smith <dexonsmith at apple.com <mailto:dexonsmith at apple.com>> wrote: > >> 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. > > I also agree that this is weird either way because they are variables when declared and passed around and functions when invoked. > > How is this different to function pointers in traditional C? >It's not different. The patch proposes to spell C++ lambdas *and other function-like variables* like functions. Essentially, anything that's callable. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180710/fad91007/attachment.html>
David Blaikie via llvm-dev
2018-Jul-10 23:25 UTC
[llvm-dev] RFC: should we spell lambdas like functions?
On Tue, Jul 10, 2018 at 4:21 PM Duncan P. N. Exon Smith < dexonsmith at apple.com> wrote:> > > On Jul. 5, 2018, at 18:12, Bruce Hoult via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > > On Thu, Jul 5, 2018 at 5:30 PM, Adrian Prantl via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> >> >> > On Jul 5, 2018, at 1:09 PM, Rui Ueyama via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> > >> >> On Thu, Jul 5, 2018 at 12:57 PM Duncan P. N. Exon Smith < >> dexonsmith at apple.com> wrote: >> >> 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. >> >> I also agree that this is weird either way because they are variables >> when declared and passed around and functions when invoked. >> > > How is this different to function pointers in traditional C? > > > > It's not different. The patch proposes to spell C++ lambdas *and other > function-like variables* like functions. Essentially, anything that's > callable. >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. - Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180710/9e99ed47/attachment.html>
Rui Ueyama via llvm-dev
2018-Jul-10 23:57 UTC
[llvm-dev] RFC: should we spell lambdas like functions?
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. On Tue, Jul 10, 2018 at 4:25 PM David Blaikie via llvm-dev < llvm-dev at lists.llvm.org> wrote:> > On Tue, Jul 10, 2018 at 4:21 PM Duncan P. N. Exon Smith < > dexonsmith at apple.com> wrote: > >> >> >> On Jul. 5, 2018, at 18:12, Bruce Hoult via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> >> >> >> On Thu, Jul 5, 2018 at 5:30 PM, Adrian Prantl via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> >>> >>> >>> > On Jul 5, 2018, at 1:09 PM, Rui Ueyama via llvm-dev < >>> llvm-dev at lists.llvm.org> wrote: >>> > >>> >> On Thu, Jul 5, 2018 at 12:57 PM Duncan P. N. Exon Smith < >>> dexonsmith at apple.com> wrote: >>> >> 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. >>> >>> I also agree that this is weird either way because they are variables >>> when declared and passed around and functions when invoked. >>> >> >> How is this different to function pointers in traditional C? >> >> >> >> It's not different. The patch proposes to spell C++ lambdas *and other >> function-like variables* like functions. Essentially, anything that's >> callable. >> > > 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. > > - Dave > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180710/9079f1a5/attachment-0001.html>