3 ms·
Syntax should be dead-simple so that correctness is obvious, compilers don't dump incomprehensible messages on trivial typos, and programmers can focus on effic
by utopcell 8y ago
Syntax should be dead-simple so that correctness is obvious, compilers don't dump incomprehensible messages on trivial typos, and programmers can focus on efficiency.
For example, in something as simple as:
int z;
while(++z)
for(int x = 1; x <= z; ++x)
for(int y = x; y <= z; ++y)
if(x*x + y*y == z*z) emit_triple(x, y, z);
a programmer would easily spot that x and y should never reach z, y should be initialized to x+1 and that this will stop working as soon as z outgrows 16-bit values. A programmer would also see that this is a horribly inefficient algorithm.
- CamperBob2 8y agoAlso, an electric shock should be emitted via the USB port whenever the compiler detects that a programmer has written 'for', 'if', and 'while' without a space, making them difficult to distinguish at a glance from function calls.
- AnimalMuppet 8y agoFunction calls can be written with spaces, too...
- mark-r 8y agoMay you burn in hell forever if you code your for/if/while without spaces and your function calls with spaces... Remember that a compiler is not the only entity reading your code, other humans have to read it too. Have pity on them, they're not as flexible as your compiler.
- utopcell 8y agoAnd let us not forget the blasphemy of bracketless blocks of code. Or uninitialized variables.
- tom_ 8y agoI'd been working for probably about 5 years before a colleague moaned at me for not doing this - and that is how I discovered that it was a thing people did. I looked again at the code, and... well, what do you know. About 75% of my colleagues did it too! I'd never noticed.