3 ms·
You run into it again when you start working with other developer's code. And once you learn to use curly braces, you don't forget that either. I haven't been
by cobrausn 14y ago
You run into it again when you start working with other developer's code.
And once you learn to use curly braces, you don't forget that either. I haven't been plagued by curly braces since college - I work with C / C++ / Lua / Ruby on a daily basis. I seriously don't see how it's any different than remembering to indent your python code. An editor certainly doesn't absolve you of that responsibility either.
I'll put it this way - when I look at a block of code with braces (or begin / end), non-rendered characters don't affect the correctness of it.
- k3n 14y agoI just think they're redundant. Indention in non-Python code is 100% aesthetic; it doesn't affect program behavior, we just do it because it helps us non-compilers understand the code. And if you follow most any sane coding standard, indention will always be congruent with braces. So, you're essentially attempting to convey the same concept -- program structure -- via 2 different mechanisms: tokens (curly braces) and indention, where of course the former is required, while the latter is the fodder of more flame wars than anyone cares to count. The sad thing is, these flame wars over code formatting are the most contentious to humans and yet the least meaningful to the compiler. One solution would be to remove the indention -- hey, we already have the tokens informing us of the lexical code boundaries...but this produces unreadable code. The other solution is to remove the tokens; since we as humans will naturally structure our code in block paradigms, then we can piggyback on a behavior that is already innate to programmers.
- pekk 14y agoEnforcing a convention (like go fmt) will also take care of the issue. However, this doesn't end up being really different from what Python does by rejecting mixed tabs and spaces. So.
- qu4z-2 14y agoI agree with you. It seems odd that we have the structural information in our program twice: Once for humans, and once for computers. The computers are perfectly capable of understanding the human construct, so let's use that.