From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) Subject: Re: C vs. Fortran - Perl wins Date: 1997/10/10 Message-ID: <61kjsd$i4r$1@goanna.cs.rmit.edu.au> X-Deja-AN: 279421382 References: <612k6f$i79@news-rocq.inria.fr> <343C3737.5435@Japan.NCR.com> <61jc3i$h2q$1@sue.cc.uregina.ca> <61jpop$6hj$1@lyra.csx.cam.ac.uk> Organization: Comp Sci, RMIT University, Melbourne, Australia. NNTP-Posting-User: ok Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec Craig Burley writes: >...second, my sense is that when the "programming explosion" began >to happen, when portability across a wide number of machines mattered, >and when the programs were doing more iron-level things like OSes, >compilers, and so on, C *was* the first *convenient* language that allowed >manipulation of pointers that were, semantically, much like the >underlying machines' pointers. "Convenient" will have to be defined fairly carefully. PL/I was and is far from my favourite language, but it _did_ have pointers, and not only did it have pointers before C existed, C even borrowed syntax from it (pointer->member). Before C was heard of at Auckland (where I did BSc and MSc), we had designed two SILs of our own (WEST, my design, and EAST, the one that was actually implemented). Automation Engineering, an Auckland company, had _their_ own SIL for M6800s or 6802s, I can't remember which. These were all pleasant Algol-like languages with pointers and also with access to machine-specific features. There was the whole Bliss family. There was MARY. The woods were *full* of systems implementation languages / machine oriented high level languages. C was merely one of *many*, and nowhere *near* the first to offer these features conveniently. No, C's virtue was that it was amongst the *least* specific of the SILs. You can forget trying to port ESPOL, ESPL, PL-11, PL-516, PL/360, and you can especially forget trying to port Bliss-10 to anything else. They were convenient enough; C is better at some things that Bliss, and worse at some. If you were trying to get close to the metal, they were _more_ convenient. The thing about C was *within a family of startlingly similar machines, which family since dominated the market*, C was a superb compromise between a general purpose language and a systems implementation language. Some say C rode UNIX's coat-tails to success; I think both of them rode the coat-tails of the twos-complement, power-of-two word size, byte addressed, flat address space machines to success. In the early 70s, at times it seemed as if _everyone_ was trying to write an operating system in a high level language (Algol dialects, PL/I dialects, even Fortran dialects and Pascal dialects). Trouble was, they were all _dialects_, and the operating systems tended to be specific to the machines they were written for. The crucial thing that I think made C the success it has been was that its implementors actually tried to _port_ programs written in C very early on. (Oh yeah, for anyone who doesn't know, ESPL was another early SIL with *much* better pointer facilities than C has ever had, including pointers that could be tied to specific areas and the ability to allocate in stack frames; not just in your own stack frame as in alloca(), but also the ability to allocate in your _caller's_ stack frame, an idea which has been reinvented under the name 'region analysis', if I've got that right). If anyone has a spare ESPL manual they don't want any more, I'd love to re-read it. >Personally, having done these kinds of programming in a variety of >assembler languages, BASIC, FORTRAN, PL/I, and C, there's no question >in my mind that C was the best tool for the job. I've had to fight >it, sure, but nowhere near the degree to which I had to to write my code >in an even-remotely-legible way (assembler and Fortran looked really >bad here), fight to gain access to the underlying iron (BASIC, FORTRAN, >and, *except* for pointers, even PL/I bad here), and have some assurance >I wasn't magically invoking tons of unrelated code to do a trivial >thing (BASIC and PL/I bad here, and now of course C++). It was the contrast between PL/I and C that first taught me a major lesson: STRINGS ARE WRONG. One of the few lessons from that era which I still find valid. >Pascal lost, because it didn't offer quite enough portability for >the low-level things programmers of these near-iron apps tended to >want to do, but not, IMO, because it was a worse language, because >it (probably) wasn't. Pascal lost because it was designed as a _teaching_ language and deliberately restricted. The consequence was that it evolved into hundreds of mutually incompatible dialects, most of which have perished. One of the areas where Pascal was very deliberately restricted in explicit contrast with earlier languages was in forbidding pointers to automatically allocated variables, which eliminated a major list-processing idiom used in Algol 68 and still used in C. >So I think John's point is quite a good one, even though, as with almost >every "de facto" standard product, the features that are claimed to make >it "unique" or "a first" really weren't actually introduced by that >product -- but were *seemingly* so introduced by virtue of being the >first product with those things that was available and convenient to >access when the need for those features began to be widely recognized. C was delicately poised between (what then passed for) generality and closeness-to-the-metal, and (what then passed for) good C compilers were available _free_ to a lot of universities. Heck, you even got the _source_ code. I've still got a listing of the PDP-11 C compiler, and if I had had to take a job where there wasn't a C compiler, I was planning to write one. These days, our standards of generality have changed dramatically, and far more importantly, the _scale_ of the projects we work on has changed dramatically. Limits you can tolerate when the largest program you can write has to fit into 64k, including stack, static, and heap data as well as code, are more of a burden when you're dealing with 64k lines of code. >Now, keep in mind that, during much of the time these issues were >*really* being thrashed out, I was at Pr1me, a world unto itself, >mostly, that took its architectural and linguistic cues from an >entirely different base -- namely, FORTRAN, PL/I, and Multics, plus >doses and dashes of other stuff here and there. I have written assembly code for a P400. Terminally weird, I say. (The programmers at Auckland University wanted a PDP-11/70 running UNIX. What we _got_ was a flaky P400 -- never get the first model of a machine in your country, waiting for parts from another country is such a pain -- with an operating system that really wanted to be running on a P300 and only grudgingly admitted that there was another instruction set that could access more memory. The Fortran compiler was written in assembly code. I tried to fix a problem with it and got completely lost. A truly _horrible_ machine to write assembly for. >C wasn't even a blip >on the radar screen when the P400 architecture was conceived, >especially for a vendor that cared a lot more about shipping a >wide performance range of compatible machines than about writing >a lot of software that'd port to alien machines. Possibly the world's worst editor, especially with the cheap glass TTYs they sold us where the return key stuttered. An interpreted Basic (the compiled Basic came later and we couldn't afford it), with Fortran and COBOL as the compiled languages. No Pascal. No Algol. No SIL. An architecture that had borrowed from Multics and an operating system that hadn't. Stack instructions which misbehaved if you crossed a page boundary. Prime's glossy brochures at the time had pictures of toy steam engines. We made rather sarcastic comments about how appropriate they were. We never did figure out how come a machine with semiconductor memory and a Fortran compiler written in assembler could be so much slower at compiling Fortran than a machine with a ferrite core memory and a Fortran compiler written in Algol. But it was. >Getting back to Perl, that is definitely one tool I want to learn, and >pretty soon. I doubt I'll find it a Great Language, but I'm pretty >sure I'll find it a decent language and a Truly Great Tool, given how >many people seem to find it so already -- or I'll learn a lot more >by figuring out why it doesn't quite make the grade, should that turn >out to be the case (but I hope it doesn't). Perl is truly disgusting and extremely useful. I personally believe that one of the main problems with Perl is how easy it makes it to implement the 'simple, obvious, and wrong' solution. (I refer to strings, of course. For much of the data Perl is used to crunch, trees are better than strings. Perl 5 makes it _possible_ to process trees, but far easier to process strings.) Has anyone written up a history of Prime? I should think it would be compelling reading for anyone interested in computer architecture. They tried to handle compatibility the onion way. Every time they ran into a restriction in the current architecture (like addressibility) they'd invent another, and ship a machine that could support _all_ the previous architectures as well. For the P500, they had a really clean 360-ish instruction set, but most of the software used one of the other four or five instruction sets, at least at the time we lost interest in Prime (Primos 19 vintage). From the outside, it really did seem as if the hardware people and the software people never talked to each other, and the software people never talked to the application developers, and _nobody_ was doing any long-term planning. I really think a technical history of the Primes would make a fascinating and instructive book. -- John �neas Byron O'Keefe; 1921/02/04-1997/09/27; TLG,TLTA,BBTNOTL. Richard A. O'Keefe; RMIT Comp.Sci; http://www.cs.rmit.edu.au/%7Eok