> On Nov 7, 2026, at 20:25, Maciej Stachowiak <[email protected]> wrote:
> 
>>> 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.

Right, it's probably useful to talk about concrete style differences.

> 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.

I don't think we should be changing the style just because other Swift code 
places { on the same line as the declaration. Plenty of C/C++ codebase does 
that too but we have our own style.

> 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.

I don't think we should put each argument on its own line. I find this style 
extremely verbose. Blink code often does that and makes the code much harder to 
follow.

I'm really not interested in re-litigating all these syntactical approaches. 
These things have been discussed in webkit-dev over the years. If we're 
changing our coding guideline, then it should be applied to both C++ and Swift 
where applicable and should be a discussion of its own.

If we're serious about adopting Swift in more parts of WebKit, then its coding 
guideline should be something we all agree upon, not something a person who 
wrote Swift code before others dictate.

- R. Niwa
_______________________________________________
webkit-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to