Alan said:
[...]
Forgive me if I'm wrong, but my impression is that you don't have a
deep enough understanding of the C language, and indeed of programming
languages in general, to appreciate the reasons for the syntax
features you're commenting on.
I believe that I appreciate the reasons for these features. What I'm
saying is that I think that there are better (in terms of allowing the
user of the language to write readable code) alternatives that could
have been implemented instead.
Take your original example of
eliminating the deli meters around the conditional in an if statement.
Think about what this would mean for compound conditions. Combine that
with the Python-style blocking and then think about an if statement
which tests for several conditions, requiring more than one line to
write.
a) Valid C syntax:
if (foo &&
bar) {
foobar();
}
b) Similar code to the above but using my suggested syntax changes:
if foo &&
bar:
foobar();
Why wouldn't (b) be feasible here?
Everything from 'if' to ':' is considered the condition. After the
newline after ':', whitespace is required to form a code block.
As you study and understand the language, you'll find that it's all
nicely consistent, and that there are good reasons for most of the
features which seem odd to you.
The only way in which they seem odd to me is that they make code much
less readable than it could be, in my opinion.
Okay, if you don't agree with the 'if'..':' idea, then how about
changing the parentheses required for test conditions for a different
pair of characters? An ideal pair would be a pair that isn't used
elsewhere in the language, for readability's sake.
One of the characteristics of C is
terseness, and extra parens aren't required by the language for no
reason.
My point is that a different construct could be substituted in each case.
Also, think about the fact that language inventors and implementers
are, by and large, a pretty bright bunch. In general, they probably
have more and wider experience in the field than you do, and some of
them might even be as smart ;-)
So those who invented C's syntax are necessarily brighter than those who
invented, say, Python's syntax?
Those features which have passed
through to modern languages have done so for a reason.
I honestly wonder what that reason is.
Regards