On Apr 29, 2016, at 11:16 AM, Noel Chiappa <jnc at
mercury.lcs.mit.edu> wrote:
From: Liam Proven
> I think it _became_ popular for two reasons:
... ii) C was a lot better
> than many of the alternatives _at the time it first appeared_ (for a
> number of reasons, which I won't expand on unless there is interest).
I am indeed interested.
OK, have to wind my brain back a _long_ way to remember what it was like
before I met C (which in my case was ca. '77).
Leaving aside places where you absolutely have to have pointers (e.g. device
drivers), the ability to allocate storage dynamically (whether via pointers,
or some alternative if you consider pointers unsafe) is just really key for
many uses, and not everything supported that.
For system work, stand-alone applications, etc pointers are really, really
useful (if not key), and there weren't that many languages with pointers. It
was an absolute revelation to see device drivers written *completely* in
higher-level language in Unix!
Anyway, for languages with that kind of capability, there was PL/I, which
although it was used for the Multics kernel, was rather a large pile; it
included a lot of stuff intended for commercial use.
...
I think BLISS was just getting started then, and outside DEC I'm not sure
many people knew much about it. Can't think of any others with pointers, but
my memory is probably failing me.
Algol didn't have (IIRC) pointers or structures - the latter are
fantastically useful when writing network code (which is what I was doing at
the time). Did BCPL have structures? I don't recall.
Algol 68 has both pointers and structures. So does Pascal. And Modula. And SYMPL
(CDC's answer to BLISS).
The main thing C has that most other languages don't is *unsafe* data typing -- the
ability to subvert the type system at the drop of a cast, and the programming tradition to
do this a lot.
It's just that a lot of things which we now take
for granted, and will be in
any 'reasonable' language (types, structures, dynamic allocation, etc)
didn't
exist in all the available alternatives back then.
And some languages had more hairy mechanisms for some things than were
probably really needed (e.g. 'thunks' in Algol, for complicated argument
support - nobody seems to miss that semantics in later languages).
True. Call by name is unique to Algol 60 (Algol 68 dropped it). Keep in mind that Algol
60 was very early; they knew they had to do better than Fortran in function argument
handling (not a high threshold). And call by name is very easy to describe in the
standard; it just gets a bit tricky when you start to implement it. Not really all that
tricky; it just amounts to passing a function pointer, and indeed you can implement call
by name in other languages by doing just that. But yes, there clearly are a couple of
Algol 60 features that in the light of more experience were judged to be not the right
idea.
C just seemed to hit a sweet spot for functionality
versus complexity - in
the syntax, in the semantics; all over.
I think it is a case of Darwin's principle, expressed correctly: "survival of the
fit enough". C sucks pretty badly in any number of places (semicolon rules is one
example if you want to pick on syntax, and the semantics are an even easier target). But
it was cheap, available, and good enough to do useful work.
paul