by HiPhish · 1y ago · 0 comments
But significant whitespace has always made sense to me. You are going to indent your code anyway, so you might as well give the indentation some meaning. I write Python, JavaScript and Lua most of the time, and I never waste any thought on whitespace VS braces VS keyword delimiters.
Autoformatters came and fixed that problem. Nobody (except python, haskell and nim coders probably) wastes time indenting code anymore, you save and your code is indented. Nowadays, code that relies on whitespace and has no ending delimiters (like nim and python) gets awkward because the formatters have less information to go on. If your rust or typescript code formats to bad indent or none at all, you have an error.
As of the "you're going to indent your code anyway" claim, this seems to completely ignore one-liners, either embedded in other documents (onClick=...) or fed to the shell as a quick way to get some work done without spawning new tools.
They can also be shown always in a very muted color if having frequent problems, for some reason.
This is a minor inconvenience, and I still use Python regularly when it makes sense, but from a language design perspective, I think it's one of those decisions that makes your users' lives that slight bit harder with no real upside.
The benefit is not having to constantly read/write delimiters. Imagine a shell where all arguments had to be delimited by , or | chars instead of whitespace.
I don't really get the readability argument - like the lisper I was replying to said, it's all much of a muchness. A shell where arguments are delimited by commas is a function call in most programming languages, and people don't struggle with readability there. If anything, I find having an explicit "close block" symbol a useful visual marker on the page, but I write Python fairly regularly and don't really notice much readability differences compared to any of the brace-using languages I work with.
The point was that whitespace was always significant. People like to pretend it isn’t for some reason. Perhaps because it has a minimum though not a maximum.
There’s a reason Python is considered very readable and “executable pseudocode.” Less delimiter and sigil noise is the main reason.
2, I sometimes want to fuck up the indentation on purpose, if I'm just quickly pasting some code to test if it even works or to mark it as "look at it in 5 minutes from now". Also I can mix spaces and tabs
quick edits it notepad/vim/whatever become painful
also converting tabs to spaces or vice-versa is tiring. A language shouldn't force me to a particular code style
This is always puzzling to me.
I've always felt that the indentation is what told me a code block ended, not a closing brace. It's graphical rather than textual.
Maybe that's why Python feels more natural to me. The indentation tells me a code block ended, and the closing brace used by other languages is just a redundancy. Languages that use things like "endif/endfor/etc" end up looking downright cluttered.
> also converting tabs to spaces or vice-versa is tiring.
Get a better IDE. I've never had this be an issue in PyCharm.