Re: [Development] Coding style for lambdas with empty parameter list
Den fre 11 jan. 2019 kl 20:11 skrev Thiago Macieira : > > On Friday, 11 January 2019 09:16:20 PST Konstantin Ritt wrote: > > +1 for []() > > Let's use <:]() instead. :D Perfect, and looks kinda like santa. Elvis > > -- > Thiago Macieira - thiago.macieira (AT) intel.com > Software Architect - Intel Open Source Technology Center > > > > ___ > Development mailing list > Development@qt-project.org > https://lists.qt-project.org/listinfo/development ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Coding style for lambdas with empty parameter list
On Friday, 11 January 2019 09:16:20 PST Konstantin Ritt wrote: > +1 for []() Let's use <:]() instead. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Coding style for lambdas with empty parameter list
+1 for []() Regards, Konstantin чт, 10 янв. 2019 г. в 15:51, Vitaly Fanaskov : > I vote for shorter form as well. > > But the documentation should be extended with the Philippe's second > example. Trailing return type is rarely required, but we cannot omit > parameters list in this case, because it leads to compilation error. > > On 1/9/19 8:31 PM, Philippe wrote: > > I like the shorter form, but keep in mind that when the return type > > needs to be specified, > > > > [] ->foo { // lambda content } > > > > is not possible, and following is needed: > > > > []() -> foo { // lambda content } > > > > Philippe > > > > On Wed, 9 Jan 2019 19:08:46 +0100 > > "André Hartmann" wrote: > > > >> Hi all, > >> > >> I recently found an inconsistency regarding empty lambda parameter lists > >> between [1] and [2]. While the first states, that parentheses have to be > >> written always, the latter is missing this section. > >> > >> My request to syncronize both [3] lead to the conclusion, to change the > rule, > >> so that empty parameter lists should be written as > >> > >> [] { // lambda content } > >> > >> instead > >> > >> []() { // lambda content } > >> > >> If anyone has objections against this change, please vote at [3]. > >> I'll keep this commit open a while and adopt the Wiki [1] once the > change > >> is approved without objections. > >> > >> Thanks and regards, > >> André > >> > >> [1] https://wiki.qt.io/Coding_Conventions#Lambdas > >> [2] > https://code.woboq.org/qt5/qt-creator/doc/api/coding-style.qdoc.html#772 > >> [3] https://codereview.qt-project.org/249192 > >> ___ > >> Development mailing list > >> Development@qt-project.org > >> https://lists.qt-project.org/listinfo/development > > > > ___ > > Development mailing list > > Development@qt-project.org > > https://lists.qt-project.org/listinfo/development > > -- > Best Regards, > > Fanaskov Vitaly > Senior Software Engineer > > The Qt Company / Qt Quick and Widgets Team > > ___ > Development mailing list > Development@qt-project.org > https://lists.qt-project.org/listinfo/development > ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Coding style for lambdas with empty parameter list
I vote for shorter form as well. But the documentation should be extended with the Philippe's second example. Trailing return type is rarely required, but we cannot omit parameters list in this case, because it leads to compilation error. On 1/9/19 8:31 PM, Philippe wrote: > I like the shorter form, but keep in mind that when the return type > needs to be specified, > > [] ->foo { // lambda content } > > is not possible, and following is needed: > > []() -> foo { // lambda content } > > Philippe > > On Wed, 9 Jan 2019 19:08:46 +0100 > "André Hartmann" wrote: > >> Hi all, >> >> I recently found an inconsistency regarding empty lambda parameter lists >> between [1] and [2]. While the first states, that parentheses have to be >> written always, the latter is missing this section. >> >> My request to syncronize both [3] lead to the conclusion, to change the rule, >> so that empty parameter lists should be written as >> >> [] { // lambda content } >> >> instead >> >> []() { // lambda content } >> >> If anyone has objections against this change, please vote at [3]. >> I'll keep this commit open a while and adopt the Wiki [1] once the change >> is approved without objections. >> >> Thanks and regards, >> André >> >> [1] https://wiki.qt.io/Coding_Conventions#Lambdas >> [2] https://code.woboq.org/qt5/qt-creator/doc/api/coding-style.qdoc.html#772 >> [3] https://codereview.qt-project.org/249192 >> ___ >> Development mailing list >> Development@qt-project.org >> https://lists.qt-project.org/listinfo/development > > ___ > Development mailing list > Development@qt-project.org > https://lists.qt-project.org/listinfo/development -- Best Regards, Fanaskov Vitaly Senior Software Engineer The Qt Company / Qt Quick and Widgets Team ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Coding style for lambdas with empty parameter list
On Wed, Jan 9, 2019 at 8:44 PM "André Hartmann" wrote: > My request to syncronize both [3] lead to the conclusion, to change the > rule, > so that empty parameter lists should be written as > > [] { // lambda content } > If I were to vote, which I won't, I'd vote instead to make the expression as explicit as possible, thus requiring even the return type to be specified. Which is also in line with my view on the auto keyword. C++ is implicit enough to pile yet more "if this is not specified, then it means something else" on top. And I personally believe that the whole syntax shouldn't have been put in the standard allowing for any choice to begin with. If you look before C99 the following kind of definitions were a real blast: functionX(parameter1, parameter2) int parameter1; float parameter2; { return 200; } Beautiful, right? The best part is, there's no need to specify the return type as well ... ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Coding style for lambdas with empty parameter list
I like the shorter form, but keep in mind that when the return type needs to be specified, [] ->foo { // lambda content } is not possible, and following is needed: []() -> foo { // lambda content } Philippe On Wed, 9 Jan 2019 19:08:46 +0100 "André Hartmann" wrote: > Hi all, > > I recently found an inconsistency regarding empty lambda parameter lists > between [1] and [2]. While the first states, that parentheses have to be > written always, the latter is missing this section. > > My request to syncronize both [3] lead to the conclusion, to change the rule, > so that empty parameter lists should be written as > > [] { // lambda content } > > instead > > []() { // lambda content } > > If anyone has objections against this change, please vote at [3]. > I'll keep this commit open a while and adopt the Wiki [1] once the change > is approved without objections. > > Thanks and regards, > André > > [1] https://wiki.qt.io/Coding_Conventions#Lambdas > [2] https://code.woboq.org/qt5/qt-creator/doc/api/coding-style.qdoc.html#772 > [3] https://codereview.qt-project.org/249192 > ___ > Development mailing list > Development@qt-project.org > https://lists.qt-project.org/listinfo/development ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
[Development] Coding style for lambdas with empty parameter list
Hi all, I recently found an inconsistency regarding empty lambda parameter lists between [1] and [2]. While the first states, that parentheses have to be written always, the latter is missing this section. My request to syncronize both [3] lead to the conclusion, to change the rule, so that empty parameter lists should be written as [] { // lambda content } instead []() { // lambda content } If anyone has objections against this change, please vote at [3]. I'll keep this commit open a while and adopt the Wiki [1] once the change is approved without objections. Thanks and regards, André [1] https://wiki.qt.io/Coding_Conventions#Lambdas [2] https://code.woboq.org/qt5/qt-creator/doc/api/coding-style.qdoc.html#772 [3] https://codereview.qt-project.org/249192 ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development