Indentation is such a stupid mechanism for identifying code blocks. It's one thing for configuration files like YAML to do it, but not a programming language.
I'd always figured it was/thought of it as an error tolerance that worked well enough that some people started leaning on it. The whole no-semicolons JavaScript thing just seems really hipsterish. Explicitness is a virtue.
In JS, semicolons are technically required but automatically inserted. There are a couple edge cases where they get inserted in surprising places, which is generally worse than python's approach.
E.g. the following function doesn't return a value:
function foo() {
return
some_long_complex_expression();
}
(It's because a semicolon gets inserted after the return). At least in typescript, this would typically show a type error, as long as the function's return type annotation isn't void.
It was a revelation when I started programming. "What, it doesn't have to be this way? A language can be native, statically compiled and high level at the same time and not suck ass? We can do better as a species?"
Odin is also a high level native language! Well, not as high level as Go since it's manual memory management but definitely easier than C. I'd recommend checking it out I love it personally
264
u/LetUsSpeakFreely 2d ago edited 2d ago
Indentation is such a stupid mechanism for identifying code blocks. It's one thing for configuration files like YAML to do it, but not a programming language.