Xref: utzoo comp.lang.misc:902 comp.lang.c:5918 Path: utzoo!mnetor!uunet!littlei!ogcvax!pase From: pase@ogcvax.UUCP (Douglas M. Pase) Newsgroups: comp.lang.misc,comp.lang.c Subject: Re: Modern langauges Message-ID: <1520@ogcvax.UUCP> Date: 30 Dec 87 20:21:24 GMT References: <8712250711.AA20205@ucbvax.Berkeley.EDU> Reply-To: pase@ogcvax.UUCP (Douglas M. Pase) Organization: Oregon Graduate Center, Beaverton, OR Lines: 90 Summary: A defense of C, an attack on Modula-2 J_ELORAN@FINJYU.BITNET writes: > [...] > > Long live C! sommar@enea.UUCP(Erland Sommarskog) writes: > >But C is no new language. Well, may be a little younger than Fortran and >Cobol, but not much. And they are all archaic. Someone once said that Lady Algol was an improvement on most of her successors. That includes C, Pascal, and Modula-2 (but not earlier versions of FORTRAN). > [Some naive comments on why C will outlive its usefulness, including > incorrect remarks about the relationship between Unix and C] >Why I find C archaic? Let me just say I think that a good language >should save you many mistakes as early as possible. This is a noble goal. A major problem with this is the definition of what constitutes a 'mistake'. Stuffing a 16 bit value into an 8 bit slot under some circumstances may constitute an error. Other times it may not. Explicitly specifying what should be obvious semantically causes programs to be verbose and tedious, both to read and to write. Overrunning the end of an array is usually accepted as an error. BUT, allowing array bounds to be determined at runtime can also be an extremely useful feature. It allows more flexible and efficient usage of memory. Unfortunately, detecting array overruns at compile time and allowing run time array definition are difficult to put together, and runtime bound checks are expensive in terms of efficiency. Some things are almost universally recognized as big no-nos. An example might be using a double precision floating point value as a structure pointer. C doesn't allow that type of operation more than any other language. But then, the arguments never seem to be over that anyway. They usually end up being stylistic arguments (and everyone has their own opinion on what constitutes 'good' style/syntax). Another source of criticism is features which at times may be useful, at other times may be hazardous. C takes a liberal view of the world. It assumes (sometimes rashly) that the programmer knows what s/he is doing. The saw that cuts the wood will also cut the hand. We have known that for years, but we still have saws. (And no, I don't want to hear about how C is missing guards that keep hands out -- the guards are there, but they must be used to be effective.) >It should also >be readable, i.e. it shouldn't unnecessarily use artificial symbols. Ah, the old verbosity argument. Shorthand should never be used in business because only those who know shorthand can read it. Let's hear it for English as a programming language. C *is* readable to those who know C. Now I do not argue that C cannot be made unreadable, but then, so can APL, Lisp, Modula-2, Pascal, and FORTRAN. I will be the first to agree that some operators in C are a bit strange, and frankly I don't know how to use them. But every time I try to include a particular op in a list of indefensible operators, someone shows me a case I hadn't thought of in which it is indispensible, or at least very useful. >Modern languages, but still in the 3rd generation, are for example >Ada, Modula-2 and Eiffel. ^^^^^^^^ Modula-2 is hardly a modern language, at least in the sense that it brings any new ideas with it. It is a rather poor extension of a language which, in its purest form, is overly simple. It is closer to a repackaging of an older language than it is to being anything new. For a more thorough criticism of Modula-2, look up an article I wrote in the November 1985 ACM SIGPLAN Notices, "System Programming in Modula-2". Ada has much in its favor, but also its share of problems. I know nothing of Eiffel. > [An illustration of C as a low level language] I agree, C is a low level language, at least in the sense that it gives you a programming model which is still very close to the machine. It was intended to be that way. It will never replace higher level languages. It was not intended to. I don't use C when I should use Lisp, APL, SmallTalk, ML, or Prolog. This shouldn't be a supprise to anyone -- I don't use a hammer to cut boards, either. >-- >Erland Sommarskog >ENEA Data, Stockholm >sommar@enea.UUCP > [Opinionated comment deleted] -- Doug Pase -- ...ucbvax!tektronix!ogcvax!pase or pase@cse.ogc.edu.csnet