I've actually seen this coding style for the same reason:

val x = Seq( // format: off
   1
  ,2
  ,3
) // format: on

Tolerating or as we have now, requiring dangling commas everywhere feels
like a bad trade off when a simple trick like this also works.


On Fri, Mar 1, 2024 at 5:53 PM Steve Lawrence <slawre...@apache.org> wrote:

> I don't know if it's a very very good reason, but I think the main
> benefit is making diffs more clear when adding to a list.
>
> Without trailing commas you get a diff like this:
>
>     Seq(
>      1,
>    - 2
>    + 2,
>    + 3
>     )
>
> But with trailing commas the diff is this:
>
>     Seq(
>      1,
>      2,
>    + 3,
>     )
>
> IMO, the latter makes it much more clear that you're just adding "3" to
> the Seq and makes code review a little easier.
>
>
> On 2024-03-01 05:36 PM, Mike Beckerle wrote:
> > Why oh why did we ever do this?
> >
> > Is anyone very attached to this dangling comma stuff in our current
> > scalafmt rules?
> >
> > I am at this point, vehemently opposed to this code style, and very much
> > want us to switch back to not allowing dangling commas.
> >
> > I've spent hundreds of hours now working this code base with this
> scalafmt
> > convention, and I have never gotten used to it. I continue to be slowed
> > down by this style, which makes it hard to read the code quickly.
> > I also find it unaesthetic and frankly just annoying. One of the things I
> > like about Scala is not having excess punctuation like Java's semicolons
> at
> > the end of every statement.
> > The cleaner, simpler Scala syntax is very nice. Why would we ugly it up
> > with trailing commas? To me if you're going to do that one might as well
> go
> > back to coding in Java.
> >
> > ?Punctuation, characters need. to be used; (correctly or it is, ) simply
> > annoying as hell
> > .
> >
> > Unless someone has a very very good reason why this should not change,
> I'm
> > very inclined to go back to scalafmt trailingCommas = never behavior.
> >
> > Thoughts?
> >
> > Mike Beckerle
> > Apache Daffodil PMC | daffodil.apache.org
> > OGF DFDL Workgroup Co-Chair |
> www.ogf.org/ogf/doku.php/standards/dfdl/dfdl
> > Owl Cyber Defense | www.owlcyberdefense.com
> >
>
>

Reply via email to