My simple smell test for language syntax readability is whether you can write a conditional statement with a multiline condition in it, without it looking ugly, and with the condition being clearly separate from the body. For example, in Lua or Ruby:
if
something()
or other()
then
do_whatever()
end
It's very easy to read; your eye doesn't "stumble" anywhere it doesn't have a reason to. In C (and Java, C# etc), on the other hand:
if (something()
|| other()) {
do_whatever()
}
This makes for some confusing indentation, and now it's hard to distinguish what's condition and what's body! Sometimes people indent the entire condition to make it clearer:
if ( something()
|| other()) {
do_whatever()
}
but now you have holes in the middle which draw attention to that spot for no good reason. Or you can put ){ on a separate line:
if (
something()
|| other()
) {
do_whatever()
}
but so much punctuation hanging by itself is still an eyesore. And Python is hardly better:
if (
something()
or other()
):
do_whatever()
Go doesn't need the () in condition, so it's slightly more tolerable if you do that (but go fmt will object):
if
something()
|| other()
{
do_whatever()
}
But I'll take the Lua/Ruby syntax any day of the week.
That's just one example. In retrospect, I think that C-style syntax was a bad idea in general, and adopting it as the "default syntax" across a large part of the industry was a monumental mistake. It favored compactness and speed of writing over readability and clarity. I really wish something like Modula or Ada would become the syntactic basis of modern languages today. I'd rather spend a few more keystrokes typing out things like "var" and "end", but end up with code that reads smoothly in a code review, or when debugging some ancient codebase.