I wonder, what is the historical reason for this style not being default? I’ve witnessed two transitions from “continuation indent” (A) to “single indent, ) goes to the new line” (B).
Kotlin code was originally written with A, because code in IntelliJ was written with A, but then they switched to B for the official style. rustc originally used A because ???, and then, with the introduction of rustfmt, it was switched to B.
B also seems much easier to maintain without tooling, as you don’t have to manually align parameters. Why is it that people seem to prefer A by default?
(A) is sometimes an initial choice because a language does not initially support trailing commas. Without trailing commas, you lose the benefit of reducing line-diffs by putting the closing paren on the next line. However, once the language picks up more traction, the complexity involved in adding support for trailing commas might be outweighed by their convenience (for formatting, code generation, etc.). If support for trailing commas does get added, the line-diff argument becomes a pretty strong argument for (B).
I think this might even have been the case for Kotlin, which I don’t think had trailing commas in its initial release, although I can’t tell if that was because Java didn’t support trailing commas, or because the preferred style was (A).
I wasn’t there when this history was being made but I’ve heard the following from the veterans of those early days:
I love this explanation. Succinct and without trying to rationalize any subjective preferences for “beauty”.
This is my preferred style in ruby as well.