C's syntax (was Re: Python Formatted C Converter (PfCC))

Alex Martelli aleaxit at yahoo.com
Mon Oct 23 03:14:55 EDT 2000


"Glyph Lefkowitz" <glyph at no.spam> wrote in message
news:m3y9zg9kn4.fsf at DHCP-98-129.origin.ea.com...
    [snip]
> (Also, there's the fact that C's syntax is actually pretty good for
> doing what C does)

I strongly disagree.  C's syntax has glaring flaws, such as being
unparsable "locally" -- i.e., without knowing what typedef's have
been previously met.  For example:

    foo * bar;

if foo has been typedef'd (and thus is now a typename), this
declares variable bar as a pointer-to-foo.  If foo has not been
typedef'd, this has a completely different meaning, "evaluate
this multiplication and throw the result away".  This absurd
state of affairs comes from back in the dark-ages of C, before
typedef had been introduced -- at that time, this would have
been a multiplication unambiguously (forgetting preprocessor
issues, which can of course introduce unbounded ambiguity --
hardly a "pretty good" situation, either:-).

Even from a human-factors point of view, such syntactic
tripwires (over which people DO keep stumbling...) as
    if(a=0) ...       /* oops, an assignment...! */
or
    foo* bar, baz;    /* NOT two pointers... */
or
    struct foo {
        int bar;
    }    /* forgot a semicolon... */

    /* int can be omitted and is implied -- how CRAZY! */
    myfun() ...
hardly combine to make C's syntax "pretty good".  TERRIBLE
is more like it.  ALL that C's syntax has going for it is
familiarity: it's a good field-test of the hypothesis that
human beings can get used to ANYTHING.  I consider the
current prevalence of C's syntax, and the resulting use
of C-like syntax in newer languages such as Java or C#,
a clear case of "Stockholm Syndrome"...:-)


Alex






More information about the Python-list mailing list