On Sat, Nov 2, 2019 at 1:23 AM Antti Koivisto <koivi...@iki.fi> wrote:

>
> On Sat, Nov 2, 2019 at 1:38 AM Ryosuke Niwa <rn...@webkit.org> wrote:
>
>> On Fri, Nov 1, 2019 at 11:53 AM Michael Catanzaro <mcatanz...@gnome.org>
>> wrote:
>>
>>> On Fri, Nov 1, 2019 at 11:19 am, Ryosuke Niwa <rn...@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?

I guess this is also consistent with the way people write objective C
blocks:
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html

For JavaScript, this rule probably doesn’t apply because arrow function and
regular anonymous function both require ().

- R. Niwa

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

Reply via email to