you are viewing a single comment's thread
view the rest of the comments
[–] 0 points 2 years ago (3 children)

Folks acting like Python is the only language without semicolons. 😏

I got tripped up so many time in the last 3 weeks using PHP after years in ML family languages. I am already newlining & it’d be poor style to put more than one statement on a line so what is the point of these semicolons?

  • source
  • hideshow 6 child comments
  • [–] 19 points 2 years ago (1 child)

    In some languages
    a newline does not
    necessarily indicate
    the end of a statement.

    In others, sometimes it could, but would leave things ambiguous
    as to whether the statement was ended or not.

    And so, punctuation is necessary.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 2 years ago

    But newlines + indentation are supported by a lot of languages & when it is, it’s easier to read since the prevailing convention is already to newline, then in indent. When you follow the usual coding styles or autoformatted & removed the semicolons, you’ve gained nothing for readability & added noise. I much prefer the languages that take this convention & bake it in so you don’t have to have that that visual noise—and in these languages, I never felt the parsing rules were ambiguous.

  • source
  • parent
  • [–] 7 points 2 years ago (2 children)

    it’d be poor style to put more than one statement on a line

    Unlike Python, most languages do not endorse a specific concept of style. You're free to dabble in all the bad style choices you like, on the off chance that once in a blue moon they prove to be situationally useful.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 2 points 2 years ago*

    Why haven't custom parsers become more of a thing? All the compiler or interpreter really needs is a valid parse tree. You could even have some kind of special command or directive to switch styles, if a section would be really ugly otherwise.

  • source
  • parent
  • [–] 1 point 2 years ago

    With indentation-based languages the bad coding style we are talking about is putting multiple statements on a line or unindenting a block …& never has that been something I wanted to do. I would rather this aspect be enforced at the language for readability where there is still room in all other aspects to try out other styles.

  • source
  • parent