Re: [webkit-dev] [Styling] Space between [] and () in C++ lambdas

2019-11-08 Thread Ryosuke Niwa
There has been no more votes either way so no space wins. Here's a patch to
codify it in our code style guidelines:
https://bugs.webkit.org/show_bug.cgi?id=204021

- R. Niwa

On Sat, Nov 2, 2019 at 8:26 PM Ryosuke Niwa  wrote:

> On Sat, Nov 2, 2019 at 10:16 AM Caitlin Potter  wrote:
>
>> Not that anybody asked me, but I also prefer to not include a space
>> between captures and parameter, for similar reasons.
>>
>> If I’m not mistaken, v8/chromium tends to omit the space as well. If
>> that’s still true and WebKit adopted that style, context switching between
>> both codebases would be marginally easier for me.
>>
>> On Nov 2, 2019, at 4:19 AM, Antti Koivisto  wrote:
>>
>> 
>>
>> On Fri, Nov 1, 2019 at 10:50 PM Yusuke Suzuki  wrote:
>>
>>>
>>> > On Nov 1, 2019, at 11:53, Michael Catanzaro 
>>> wrote:
>>> >
>>> > On Fri, Nov 1, 2019 at 11:19 am, Ryosuke Niwa 
>>> wrote:
>>> >> Namely, some people write a lambda as:
>>> >> auto x = [] () { }
>>> >> with a space between [] and () while others would write it as:
>>> >> auto x = []() { }
>>> >
>>> > : I omit the () when there are no parameters, as in these examples.
>>> >
>>> > No preference on spacing.
>>>
>>> I like having a space here, because this rule is simpler to me.
>>> If we always have a space between them, this is clear that the above
>>> case is written in `[] { }` instead of `[]{ }`.
>>>
>>
>> I prefer not having the redundant space in [](). It also makes logical
>> sense to me to keep the lambda signature together. I started using lambdas
>> with space there, dropped it later, and suffered no adverse consequences.
>>
>> As for existing practice, WebCore favors spaceless ]( about 2:1 but
>> across the entire WebKit it is closer to 1:1.
>>
>> We always put space before { } block, I don't think that is really in
>> question here, or creating any inconsistencies.
>>
>>
>>antti
>>
>>
>>>
>>> -Yusuke
>>>
>>> >
>>> >
>>> > ___
>>> > webkit-dev mailing list
>>> > webkit-dev@lists.webkit.org
>>> > https://lists.webkit.org/mailman/listinfo/webkit-dev
>>>
>>> ___
>>> webkit-dev mailing list
>>> webkit-dev@lists.webkit.org
>>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>>>
>> ___
>> webkit-dev mailing list
>> webkit-dev@lists.webkit.org
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>>
>> ___
>> webkit-dev mailing list
>> webkit-dev@lists.webkit.org
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>>
> --
> - R. Niwa
>
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] [Styling] Space between [] and () in C++ lambdas

2019-11-02 Thread Caitlin Potter
Not that anybody asked me, but I also prefer to not include a space between 
captures and parameter, for similar reasons.

If I’m not mistaken, v8/chromium tends to omit the space as well. If that’s 
still true and WebKit adopted that style, context switching between both 
codebases would be marginally easier for me.

> On Nov 2, 2019, at 4:19 AM, Antti Koivisto  wrote:
> 
> 
>> On Fri, Nov 1, 2019 at 10:50 PM Yusuke Suzuki  wrote:
>> 
>> > On Nov 1, 2019, at 11:53, Michael Catanzaro  wrote:
>> > 
>> > On Fri, Nov 1, 2019 at 11:19 am, Ryosuke Niwa  wrote:
>> >> Namely, some people write a lambda as:
>> >> auto x = [] () { }
>> >> with a space between [] and () while others would write it as:
>> >> auto x = []() { }
>> > 
>> > : I omit the () when there are no parameters, as in these examples.
>> > 
>> > No preference on spacing.
>> 
>> I like having a space here, because this rule is simpler to me.
>> If we always have a space between them, this is clear that the above case is 
>> written in `[] { }` instead of `[]{ }`.
> 
> I prefer not having the redundant space in [](). It also makes logical sense 
> to me to keep the lambda signature together. I started using lambdas with 
> space there, dropped it later, and suffered no adverse consequences.
> 
> As for existing practice, WebCore favors spaceless ]( about 2:1 but across 
> the entire WebKit it is closer to 1:1.
> 
> We always put space before { } block, I don't think that is really in 
> question here, or creating any inconsistencies.
> 
> 
>antti
>  
>> 
>> -Yusuke
>> 
>> > 
>> > 
>> > ___
>> > webkit-dev mailing list
>> > webkit-dev@lists.webkit.org
>> > https://lists.webkit.org/mailman/listinfo/webkit-dev
>> 
>> ___
>> webkit-dev mailing list
>> webkit-dev@lists.webkit.org
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] [Styling] Space between [] and () in C++ lambdas

2019-11-02 Thread Antti Koivisto
On Fri, Nov 1, 2019 at 10:50 PM Yusuke Suzuki  wrote:

>
> > On Nov 1, 2019, at 11:53, Michael Catanzaro 
> wrote:
> >
> > On Fri, Nov 1, 2019 at 11:19 am, Ryosuke Niwa  wrote:
> >> Namely, some people write a lambda as:
> >> auto x = [] () { }
> >> with a space between [] and () while others would write it as:
> >> auto x = []() { }
> >
> > : I omit the () when there are no parameters, as in these examples.
> >
> > No preference on spacing.
>
> I like having a space here, because this rule is simpler to me.
> If we always have a space between them, this is clear that the above case
> is written in `[] { }` instead of `[]{ }`.
>

I prefer not having the redundant space in [](). It also makes logical
sense to me to keep the lambda signature together. I started using lambdas
with space there, dropped it later, and suffered no adverse consequences.

As for existing practice, WebCore favors spaceless ]( about 2:1 but across
the entire WebKit it is closer to 1:1.

We always put space before { } block, I don't think that is really in
question here, or creating any inconsistencies.


   antti


>
> -Yusuke
>
> >
> >
> > ___
> > webkit-dev mailing list
> > webkit-dev@lists.webkit.org
> > https://lists.webkit.org/mailman/listinfo/webkit-dev
>
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] [Styling] Space between [] and () in C++ lambdas

2019-11-01 Thread Yusuke Suzuki

> On Nov 1, 2019, at 11:53, Michael Catanzaro  wrote:
> 
> On Fri, Nov 1, 2019 at 11:19 am, Ryosuke Niwa  wrote:
>> Namely, some people write a lambda as:
>> auto x = [] () { }
>> with a space between [] and () while others would write it as:
>> auto x = []() { }
> 
> : I omit the () when there are no parameters, as in these examples.
> 
> No preference on spacing.

I like having a space here, because this rule is simpler to me.
If we always have a space between them, this is clear that the above case is 
written in `[] { }` instead of `[]{ }`.

-Yusuke

> 
> 
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] [Styling] Space between [] and () in C++ lambdas

2019-11-01 Thread Michael Catanzaro

On Fri, Nov 1, 2019 at 11:19 am, Ryosuke Niwa  wrote:

Namely, some people write a lambda as:
auto x = [] () { }

with a space between [] and () while others would write it as:

auto x = []() { }


: I omit the () when there are no parameters, as in these examples.

No preference on spacing.


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] [Styling] Space between [] and () in C++ lambdas

2019-11-01 Thread Ryosuke Niwa
On Fri, Nov 1, 2019 at 11:19 AM Ryosuke Niwa  wrote:

> Hi all,
>
> There seems to be inconsistency in our coding style with regards to
> spacing in lambdas.
>
> Namely, some people write a lambda as:
> auto x = [] () { }
>
> with a space between [] and () while others would write it as:
>
> auto x = []() { }
>
> without a space between the two. I'd like to require either style in our
> guideline so that things are consistent in our codebase. Which one should
> we use?
>
> FWIW, I mildly prefer having a space between [] and ().
>

I forgot to mention that according to Antti
, the existing code in
WebCore places no space between ] and ( with 2:1 ratio.
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] [Styling] Space between [] and () in C++ lambdas

2019-11-01 Thread Chris Dumez
I mildly prefer without the space :)

--
 Chris Dumez




> On Nov 1, 2019, at 11:19 AM, Ryosuke Niwa  wrote:
> 
> Hi all,
> 
> There seems to be inconsistency in our coding style with regards to spacing 
> in lambdas.
> 
> Namely, some people write a lambda as:
> auto x = [] () { }
> 
> with a space between [] and () while others would write it as:
> 
> auto x = []() { }
> 
> without a space between the two. I'd like to require either style in our 
> guideline so that things are consistent in our codebase. Which one should we 
> use?
> 
> FWIW, I mildly prefer having a space between [] and ().
> 
> - R. Niwa
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] [Styling] Space between [] and () in C++ lambdas

2019-11-01 Thread Saam Barati



> On Nov 1, 2019, at 11:19 AM, Ryosuke Niwa  wrote:
> 
> Hi all,
> 
> There seems to be inconsistency in our coding style with regards to spacing 
> in lambdas.
I've noticed this too and the lack of consistency slightly annoys me.

> 
> Namely, some people write a lambda as:
> auto x = [] () { }
> 
> with a space between [] and () while others would write it as:
> 
> auto x = []() { }
> 
> without a space between the two. I'd like to require either style in our 
> guideline so that things are consistent in our codebase. Which one should we 
> use?
> 
> FWIW, I mildly prefer having a space between [] and ().
Same. My vote is to have a space.

- Saam

> 
> - R. Niwa
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev