It's always semicolon, God damnit.......
It's always semicolon, God damnit.......
It's always semicolon, God damnit.......
import " " as ;
I;don't;think;that;helps
For bonus points take their code and completely go wild with utterly random indentation and line breaks, just to drive the point home. π
That's actually me removing semicolons from Python.
How does one manually add a semicolon? vs. automatically?
JS formatters add them if the project requires it
Manually would be if it prompted you every time you every time the program inserts one. No, wait...
PythonAmateur programmers
This is why linting and auto-format on save exists in IDEs. Don't make things harder on yourself.
That said, with how few expressions are return values, I do wonder why semicolons are the default rather than adding a special character to indicate return values.
you mean like return/break/etc.?
because Rust was designed to remind you of functional programming despite not being very functional, and because semicolons allow way better syntax rules in Rust and are generally pretty vital for good, readable lowish-level code. it also allows Rust programmers to use newlines/indents and stuff to pretty up their code a lot without littering it with random \
and |>
and begin
end
and such everywhere, which, given how dense Rust code can be and how much it uses iterators and weird trait magic, is a big plus for readability
I have a plugin in VSCode to remind me not to forget the semicolons
I was taught python by my school but I would rather write in other languages but the difference in formatting still gets me after years
can I interest you in some delicious linters
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?
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.
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.
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.
The best languages about really embracing punctuation as you would in English is Prolog & Erlang with their periods, semicolons, & commas.
I was brought up on C, did a module of Java at uni, and am doing an algorithms course which is python heavy.
My other half - who's quite handy with Python - looks in sheer horror at my code which is littered with semicolons.
I was stumped for half an hour figuring out why the Python interpreter was bouncing an error before it had even reached the main program logic... turns out a { before the block of code royally ruins the interpreter's day.
Still, I live and learn.