Hacker News new | ask | show | jobs
by silveraxe93 637 days ago
Yeah, unfortunately you're right that they are real conventions. Quite common too.

I also _understand_ why they exist. It's simple: It makes code marginally easier to write.

But writing confusing, unintuitive and honestly plain ugly code. Just so you can save a second after clicking run and the compiler tells you the mistake is a bad reason.

1 comments

A lot of "readability" depends on what you're used to and what you expect. I don't think these conventions are inherently "ugly" or "confusing", but they are different to what I've been doing for a long time, and thus unexpected, and thus "ugly". But that's extremely subjective.

I've done plenty of SQL, and I've regularly run in to the "fuck about with fucking trailing commas until it's valid syntax"-problem. It's a very reasonable convention to have.

What should really happen is that the SQL standard should allow trailing commas:

  select
     a,
     b,
  from t;
> A lot of "readability" depends on what you're used to and what you expect.

Yes. Typically shared sense of "readability" in a community for language X translates to "idiomatic patterns when writing X". There's no real thing as readability in a universal sense. It's a placeholder statement for "it's easier for ME to understand", double emphasis on "ME". Within a community, "readability" standards are merely channeling the idiomatic patterns within that community as for most members they'll be easier for the person to understand as it's what they're used to seeing.

Yes pleeease allow trailing commas. The amount of times I have stubbed my foot on that... Especially when removing or commenting out a line. Doesn't help that many environments where SQL used has poor syntax highlights on errors. Looking at you, Grafana...