> On Nov 7, 2026, at 4:36 AM, Ryosuke Niwa via webkit-dev
> <[email protected]> wrote:
>
>
>> On Nov 6, 2026, at 00:05, Geoff Garen via webkit-dev
>> <[email protected]> wrote:
>>
>> I think this debate would be easier to resolve if it moved from
>> abstractions like “C++ style” and “Swift style” to specific style rules.
>>
>> Would someone who prefers “Swift style” be willing to list some specific
>> deviations from WebKit’s C++ style guidelines, why they prefer those
>> deviations, and why that preference should outweigh concerns about
>> consistency?
>>
>> One deviation I heard was “no un-required semicolons”. First, I agree with
>> that proposal. Second, as stated it may not technically be a deviation from
>> WebKit’s C++ style guidelines — C++ just happens to require semicolons in
>> more places.
>
> Right, but nothing in our coding style guideline says about semicolon so
> that's consistent with the proposal to use the same coding style guideline.
To the best of my understanding of the JSON style rules that Richard linked,
quite a few of the rules there are not covered at all in the C++ guidelines and
logically would not be because they pertain to Swift constructs that aren’t in
C++.
Since it;s hard to compare prose rules with rules implemented in code, maybe we
could look at some real Swift code linted (and/or hand written) to follow the
de facto Swift style rules.
What if any deviations do you see from WebKit’s coding style for C++? The only
difference that standards out to be is the opening curly brace for functions
being on the same line as the declaration instead of its own line. But that
seems to genuinely pervasive Swift convention, and everything else about the
function declaration syntax is different too, so it doesn’t seem like a huge
win to go separate brace.
https://github.com/WebKit/WebKit/blob/main/Source/WebKit/UIProcess/WebBackForwardList.swift
Here’s some code that may have been written without the guidelines as closely
in mind. It looks basically the same except that function declarations with
multiple parameters are written with a line per parameter.
https://github.com/WebKit/WebKit/blob/main/Source/WebGPU/WebGPU/CommandEncoder.swift
- Maciej
_______________________________________________
webkit-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]