archives

In defense of semicolon

I've noticed a lot of noise recently about getting rid of mandatory semicolons in mainstream imperative languages because...well...we can! I remember when this move was made in Scala, it was a bit painful with corner cases and error messages, but most of the community was happier with it. But I thought we lost something, let's look at the good and bad of semicolons:

Bad:

  • That semicolons can be inferred deterministically means that they are redundant.
  • Visual verbosity and clutter.
  • extra (keyboard) typing.
  • Anachronistic.

Good:

  • Redundancy enhances error detection (and robust IDE tooling in general).
  • Redundancy enhances readability.
  • They aren't really that hard to type.
  • Inference that depends on parsing probably goes a bit too far (Scala) in that its not always obvious to human readers where semicolons are inferred.

Did I miss anything?