[webkit-dev] [Styling] () for a lambda without arguments (Was Space between [] and () in C++ lambdas)

Ryosuke Niwa rniwa at webkit.org
Sat Nov 2 20:27:06 PDT 2019


On Sat, Nov 2, 2019 at 8:25 PM Ryosuke Niwa <rniwa at webkit.org> wrote:

>
> On Sat, Nov 2, 2019 at 7:54 PM Chris Dumez <cdumez at apple.com> wrote:
>
>>
>>
>> On Nov 2, 2019, at 7:38 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
>>
>> 
>>
>> On Sat, Nov 2, 2019 at 1:23 AM Antti Koivisto <koivisto at iki.fi> wrote:
>>
>>>
>>> On Sat, Nov 2, 2019 at 1:38 AM Ryosuke Niwa <rniwa at webkit.org> wrote:
>>>
>>>> On Fri, Nov 1, 2019 at 11:53 AM Michael Catanzaro <mcatanzaro at gnome.org>
>>>> wrote:
>>>>
>>>>> On Fri, Nov 1, 2019 at 11:19 am, Ryosuke Niwa <rniwa at webkit.org>
>>>>> 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.
>>>>>
>>>>
>>>> I guess that's another thing we should decide. Should we, or should we
>>>> not have () when there are no arguments.
>>>>
>>>
>>> I think this is easily settled by voting via exiting practice. We have
>>> 1287 instances of [&] { and 107 instances of [&]() { and &] () { across the
>>> whole WebKit.
>>>
>>
>> That’s good to know. Why don’t we go with the status quo then.
>>
>> In this case, we do put a space between ] or ) and {, right?
>>
>>
>> How is this the conclusion from Antti’s comment?
>>
>> Based on the discussion so far, it thought no space had a slight lead.
>>
>
> I think you’re conflating this discussion with the other email thread
> about a space between [] and ().
>
> Here, I’m talking about placing a space after [] before { as in:
> [] { }
>
> As opposed to:
> []{ }
>
> We never use the latter style whether it’s other control flow statements
> like if, while, or for, or for function definitions.
>
> - R. Niwa
>
> --
> - R. Niwa
>
-- 
- R. Niwa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20191102/077cdd11/attachment.htm>


More information about the webkit-dev mailing list