From: crawford@boole.mitre.org (Randy Crawford)
Subject: Re: Pointers
Organization: The MITRE Corporation, McLean, VA
Date: Tue, 10 Nov 1992 02:40:21 GMT

>>In article <1992Nov3.130634.26112@rdg.dec.com> jch@rdg.dec.com (John Haxby) writes:
>>>|> In article <1992Nov2.083810.1652@syacus.acus.oz.au> ian@syacus.acus.oz.au (Ian Joyner) writes:
>>>|> You simply don't need C style pointers in decent programming languages.
>>>
>>>C's pointers don't actually provide anything useful, apart from,
>>>perhaps, an ability to duplicate Lindsay's `triple ref' code.

[lots of tangential comments deleted]

I think that most of the preceding remarks have missed the original point
that was made.  My defense of C's pointers was not an assertion that C is the 
end-all of programming languages nor that pointers are the best way to do
everything.  (Amazing how far afield these religious discussions can wander.)

C is a perfectly good model for a programming language.  Its design is quite
consistent with a very successful genre of programming languages (FORTRAN, 
Pascal, PL/1, BASIC, Algol).  C was designed so that its compiler might be 
easy and fast to implement on various architectures (some with very little 
available RAM) while producing good code and supporting low-level services.  
If you disagree with this synopsis -- fine, argue among yourselves about 
garbage collection if you like.  But given the above criteria, C has been a 
major success.  Each of us will be damned lucky if we accomplish as much in 
our lives as Dennis Ritchie did 23 years ago in inventing C.

That C isn't ideal for programming in the large, or highly numerical use, or
automatic parallelization, or foolproof boo-boo checking isn't of interest to
me and isn't the original complaint to which I responded.

I defy the critics in this forum to devise a programming language which has 
the ability to outperform C given the constraints I have listed above.  Ever
build a compiler to run in 20K of RAM and produce executables which must run
in an equally tiny space?  What language would you prefer, Ada, PL/1 or perhaps
Pascal?  Good luck.  If you hope to design a language as powerful and flexible 
as C with a compiler as small, portable and simple, you will have to consider 
as Dennis Ritchie did what it is you cannot live without in a programming 
language.  I suspect that even with 23 years of hindsight that he did not have,
your end product will look a lot like K&R C.  And it may well have _pointers_.

Remember too, that when C was born in 1969, most programmers were still 
fighting with 300 baud modems, paper tape, and columnar punch cards.  A terse 
powerful programming language like C, with user-defined types, dynamic memory 
and free-form syntax was a huge step forward.  In a lot of ways, more modern 
languages are still trying to catch up.  It was 1992 before Ada 9X offered us 
pointers to functions.  But two decades ago they were available in C.

It's easy to nitpick a language to death for its faults while ignoring its 
merits; especially so when it is discussed out of context, apart from its 
history.  My original defense of C's pointers stands.  They are a remarkably
useful construct which have served their purpose well.

-- 

| Randy Crawford        crawford@mitre.org        The MITRE Corporation
|                                                 7525 Colshire Dr., MS Z421
| N=1 -> P=NP           703 883-7940              McLean, VA  22102
Newsgroups: comp.lang.misc