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?
I think that in many languages, semicolons are more of a formality. Javascript has a few weird edge cases that cause very silly bugs when you omit semicolons, but it works fine without them in most cases. Kotlin is mostly semicolonless and I find Kotlin code a lot more readable than equivalent Java code.
It would not be that hard to parse semicolonless code in a language designed for it. The parser knows when a statement or expression is over, even if you split it among multiple lines. Debugging mismatched parentheses would become hell without an intelligent compiler, though.
Language designers just like the explicit end-of-statement character. I’ve seen languages that use a full stop to separate statements and expressions and I honestly don’t understand why we don’t do that in more languages; it makes semantic sense.
However, in the end, it’s not exactly hard to use semicolons, so I don’t see the problem with keeping them around either. Some people get real uppity about semicolons, either in favour or against them, though.
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.
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.
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.
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?
I think that in many languages, semicolons are more of a formality. Javascript has a few weird edge cases that cause very silly bugs when you omit semicolons, but it works fine without them in most cases. Kotlin is mostly semicolonless and I find Kotlin code a lot more readable than equivalent Java code.
It would not be that hard to parse semicolonless code in a language designed for it. The parser knows when a statement or expression is over, even if you split it among multiple lines. Debugging mismatched parentheses would become hell without an intelligent compiler, though.
Language designers just like the explicit end-of-statement character. I’ve seen languages that use a full stop to separate statements and expressions and I honestly don’t understand why we don’t do that in more languages; it makes semantic sense.
However, in the end, it’s not exactly hard to use semicolons, so I don’t see the problem with keeping them around either. Some people get real uppity about semicolons, either in favour or against them, though.
The best languages about really embracing punctuation as you would in English is Prolog & Erlang with their periods, semicolons, & commas.
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.
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.
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.
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.