[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-dev
Subject:    Re: [webkit-dev] [Styling] () for a lambda without arguments (Was Space between [] and () in C++ lam
From:       Antti Koivisto <koivisto () iki ! fi>
Date:       2019-11-02 8:23:32
Message-ID: CAGk4BFZH_rOGonCkrOcor+t5NuAb=T=8_eKAB1qyz1B7ST-Jtg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Sat, Nov 2, 2019 at 1:38 AM Ryosuke Niwa <rniwa@webkit.org> wrote:

> On Fri, Nov 1, 2019 at 11:53 AM Michael Catanzaro <mcatanzaro@gnome.org>
> wrote:
>
>> On Fri, Nov 1, 2019 at 11:19 am, Ryosuke Niwa <rniwa@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.


   antti


>
> I think we usually err on the side of more concise form but I do prefer
> having () so that it's clear it's a function. Otherwise, it can look like a
> code block start & end.
>
> - R. Niwa
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>

[Attachment #5 (text/html)]

<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Nov 2, 2019 at 1:38 AM \
Ryosuke Niwa &lt;<a href="mailto:rniwa@webkit.org">rniwa@webkit.org</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div \
dir="ltr"><div dir="ltr">On Fri, Nov 1, 2019 at 11:53 AM Michael Catanzaro &lt;<a \
href="mailto:mcatanzaro@gnome.org" target="_blank">mcatanzaro@gnome.org</a>&gt; \
wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On \
Fri, Nov 1, 2019 at 11:19 am, Ryosuke Niwa &lt;<a href="mailto:rniwa@webkit.org" \
target="_blank">rniwa@webkit.org</a>&gt; wrote:<br> &gt; Namely, some people write a \
lambda as:<br> &gt; auto x = [] () { }<br>
&gt; <br>
&gt; with a space between [] and () while others would write it as:<br>
&gt; <br>
&gt; auto x = []() { }<br>
<br>
🔧: I omit the () when there are no parameters, as in these \
examples.<br></blockquote><div><br></div><div>I guess that&#39;s another thing we \
should decide. Should we, or should we not have () when there are no \
arguments.</div></div></div></blockquote><div><br></div><div>I think this is easily \
settled by voting via exiting practice. We have 1287 instances of [&amp;] { and 107 \
instances  of [&amp;]() { and  &amp;] () { across the whole \
WebKit.</div><div><br></div><div><br></div><div>     antti</div><div>  \
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div \
dir="ltr"><div class="gmail_quote"><div><br></div><div>I think we usually err on the \
side of more concise  form but I do prefer having () so that it&#39;s clear it&#39;s \
a function. Otherwise, it can look like a code block start &amp; \
end.</div><div><br></div><div>- R. Niwa</div><div><br></div></div></div> \
_______________________________________________<br> webkit-dev mailing list<br>
<a href="mailto:webkit-dev@lists.webkit.org" \
target="_blank">webkit-dev@lists.webkit.org</a><br> <a \
href="https://lists.webkit.org/mailman/listinfo/webkit-dev" rel="noreferrer" \
target="_blank">https://lists.webkit.org/mailman/listinfo/webkit-dev</a><br> \
</blockquote></div></div></div>



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic