From: Craig Burley <burley@tweedledumb.cygnus.com>
Subject: Re: C language
Date: 1997/10/09 [thread overview]
Message-ID: <y67mbmu7wr.fsf@tweedledumb.cygnus.com> (raw)
In-Reply-To: 343C3737.5435@Japan.NCR.com
Eric Hildum <Eric.Hildum@Japan.NCR.com> writes:
> To put it bluntly, C is not a high level language. It is a syntactically
> nice PDP 11/70 assembly language. That is all it was intended to be.
> That it is useful outside that domain is more a credit to the PDP
> instruction set designers than K & R.
>
> As a language, C is relatively poor, for example, the stupid overloading
> of the keyword static.
Yeah, but, C is a great *tool*. It's *such* a great tool that
because it, like awk, sed, perl, make, tar, and so on,
necessarily defines an input "language" in the comp.sci (formal
language) sense, the inexperienced conclude that it is a great
*language*.
Fortran comes from an older tradition when formal languages were
less understood, and artificial languages (my term for true languages
designed to meet artificial, e.g. technological, needs, covering
computer languages and stuff like GUIs) even less so. As such,
it didn't show the benefits of good formal-language design (e.g.
nobody can say what "X(Y)=Z" really means in Fortran without
knowing the context, and this does confuse programmers in practice),
but it also didn't show the disadvantages of formal-language
design techniques (e.g. the arrogance that says "if I can write a
small-enough yacc input file for my language, it is therefore a
Good Language").
Yet, despite my long decades of distate for Fortran, the more I've
learned about what constitutes good *language* design, the more I've
had to conclude that, for scientific/numeric processing, Fortran
not only *was* a better language in its day than C in *its*, but it
(Fortran 90) is *today* a better language than C *today*. (And C++
is even worse a language than C. At least programmers know what
`a = b + c;' means in C.)
The essential lesson I finally learned was:
Formal languages are to languages what mathematics is to music.
I think the creation of the term "formal language" itself was a
mistake, because it misleads the audience into thinking that *some*
kind of language is being described, in a useful sense, but in fact
"formal language" encompasses much more than the tiny portion of the
generally useful term "language" than is connoted by the term, in
much the same sense that "formal music" would have been a poor term
instead of "mathematics".
So we end up with "brilliant" C programmers who assume that, because
C is (mistakenly) called a "language", and because C is a great *tool*,
it is a good language, and since Fortran isn't such a great tool,
it must be a lesser language, when the opposite is true.
At least, that's what happened to me. I learned about formal languages
(and aced a .400 course on "Computability, Formal Languages, and
Automatons" or some such thing in my one and only semester as a
college student) when I was 17.5-18.1 years old, but I'd already had
a fair amount (for a kid anyway ;-) experience designing artificial
languages before having the theoretical grounding.
So, for years, probably well over a decade, I, too, mistakenly thought
that since I understood the *mechanics* of language design (that is,
I could construct formal languages, understood how to avoid ambiguities,
write parsers, and so on), I knew all I needed to know to properly
assess computer languages on their merits, perhaps even design one myself.
Then it began to dawn on me, as the years went by and I dealt with
programming bugs (my own and others, since I've usually been one of
the "known skilled debuggers" wherever I've worked), among other stuff,
that an understanding of the mechanics of artificial languages was about
as definitive a basis for assessing the languages themselves as
an understanding of the mechanics of tone reproduction is for assessing
the quality of Bach, Mozart, Beethoven, et al. Both are useful skills,
but they do *not*, by themselves give the person possessing those skills
the viewpoint necessary to assess the higher, more complex aspects of
design and composition.
Having worked on a variety of compilers and operating systems at this
point, probably 80% of the relevant code being *considered* "written
in C", it is pretty amazing to me to hear people talk about what a
great language C is when, for even the most trivial stuff, we must
go effectively "outside" the language. Using preprocessor macros
*starts* to go outside the language (consider how ineffective
"#define SUM(a,b) a+b" and "#define MUL(a,b) a*b" are in connoting
what a programmer *means* given the possible occurrence of an expression
such as "d = MUL(SUM(e,f),g);"), but resorting to stuff like
#include "tree.def" and #include "rtl.def" as gcc does, and, further,
resorting to Lisp-like code to "express" how a "low-level" machine
works (clarifying the statement "C is a good low-level language"; it
*is* a good low-level *tool*) as gcc also does in its machine
descriptions, shows how *poor* a language C is at doing *ordinary*
things. Heck, its lousy string processing is probably a major
reason why so many tools (that in some classic systems would be
written in BASIC or even FORTRAN) are written in *sh* in the UNIX
world! And there's still much more disagreement about, and widespread
poor use of, the proper use of #include than there seems to be about
how to use INCLUDE or MODULE/USE in Fortran, modules in Ada, and
so on.
I mean, even ancient Fortran had (poorly designed, due to looking
too much like assignments) statement functions like "SUM(A,B)=A+B"
and "MUL(A,B)=A*B". Get the types right ("REAL MUL", for example),
and it's much harder to accidentally write broken code using these
in Fortran -- e.g. "D = MUL(SUM(E,F),G)" will actually *work*,
unlike the C version of all this as shown above.
The C bigots' typical response to the C version of this? "Well,
you're *supposed* to put *parentheses* around the macro's dummy
arguments!" Right. That's what makes it a poor language -- if
someone forgets to do it, only a *highly experienced* C programmer
is likely to notice the bug. (Yes, Fortran has some gotchas
like this, too, mostly due to its ancient lack of orthagonality,
something for which C, at least, has no excuse.)
By understanding the science/art of *artifical language design* we
have a better chance of recognizing, perhaps designing, effective
new languages for expressing what a computer is expected to do
in a way readers are least likely to misunderstand and computers
(compilers, etc.) most likely to implement efficiently.
And, of course, computer architecture design is, in practice,
*quite* dependent on the designs of, and assumptions made by users
of, artificial languages.
The legions of "C bigots", by which I mean those who think C is
a great *language* ("better than that stupid Fortran!"), will
contribute little towards a future of more powerful, clean,
reliable, and efficient computing, because they don't understand
the issues -- yet. (And the lemmings still walking off the C++
cliff certainly won't either.)
However, until the public stops buying mediocre, buggy software,
and/or the computer architects (Intel, Digital, Sun, and so on)
can no longer give us 2x speedups every few months or so, there
probably won't be enough pressure to design new languages
correctly.
So, while I think someday we *will* need SWYM (Say What You Mean)
technology in artificial-langauge design, for the time being,
economic and technological forces continue to push hard for GISS
(Get It Shrinkwrapped, Stupid), which is why C is still so popular.
--
"Practice random senselessness and act kind of beautiful."
James Craig Burley, Software Craftsperson burley@gnu.ai.mit.edu
next prev parent reply other threads:[~1997-10-09 4:00 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-10-03 4:00 Final kick at the "Merced Guessing Game" Robert Harley
1997-10-06 4:00 ` Richard A. O'Keefe
1997-10-06 4:00 ` boo
1997-10-07 4:00 ` Richard A. O'Keefe
1997-10-06 4:00 ` Graham Hughes
1997-10-07 4:00 ` boo
1997-10-07 4:00 ` William Clodius
1997-10-07 4:00 ` William Clodius
1997-10-08 4:00 ` Richard A. O'Keefe
1997-10-08 4:00 ` William Clodius
1997-10-08 4:00 ` William Clodius
[not found] ` <y4wwjon203.fsf@mailhost.neuroinformatik.ruhr-uni-bochum.de>
1997-10-08 4:00 ` William Clodius
1997-10-08 4:00 ` Stanley Chow
1997-10-09 4:00 ` William Clodius
1997-10-10 4:00 ` Larry Kilgallen
1997-10-10 4:00 ` Zalman Stern
1997-10-11 4:00 ` Andrew Cruickshank
1997-10-12 4:00 ` Paul D. DeRocco
1997-10-13 4:00 ` Michael Williams
1997-10-08 4:00 ` Gregg E Economou
1997-10-08 4:00 ` David Chase
1997-10-08 4:00 ` Richard A. O'Keefe
1997-10-07 4:00 ` Carlie Coats
1997-10-07 4:00 ` Paul Hsieh
1997-10-07 4:00 ` boo
1997-10-08 4:00 ` Carlie Coats
[not found] ` <343C3737.5435@Japan.NCR.com>
1997-10-09 4:00 ` Craig Burley [this message]
[not found] ` <61jc3i$h2q$1@sue.cc.uregina.ca>
1997-10-09 4:00 ` C vs. Fortran - Perl wins Nick Maclaren
1997-10-09 4:00 ` Craig Burley
1997-10-10 4:00 ` Richard A. O'Keefe
1997-10-10 4:00 ` David Gay
1997-10-10 4:00 ` Craig Burley
1997-10-13 4:00 ` Roger Barnett
1997-10-14 4:00 ` Richard A. O'Keefe
1997-10-18 4:00 ` Tom
1997-10-07 4:00 ` Final kick at the "Merced Guessing Game" Serge Pachkovsky
1997-10-07 4:00 ` Martin Rodgers
1997-10-07 4:00 ` Greg Weeks
1997-10-07 4:00 ` Martin Rodgers
[not found] ` <343AAE5A.A3FCC9D@no.informatik.spam.tu-muenchen.thanks.de>
1997-10-09 4:00 ` Torben AEgidius Mogensen
[not found] ` <EHsr7B.Dt8@bit3.com>
1997-10-10 4:00 ` Torben AEgidius Mogensen
[not found] ` <61cv5e$qn$6@vixen.cso.uiuc.edu>
1997-10-08 4:00 ` William Clodius
1997-10-08 4:00 ` James C. Stutts
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox