7 ms·
c
by SaxonRobber 7y ago
c
- pjmlp 7y agoHardly, "Allen: Oh, it was quite a while ago. I kind of stopped when C came out. That was a big blow. We were making so much good progress on optimizations and transformations. We were getting rid of just one nice problem after another. When C came out, at one of the SIGPLAN compiler conferences, there was a debate between Steve Johnson from Bell Labs, who was supporting C, and one of our people, Bill Harrison, who was working on a project that I had at that time supporting automatic optimization...The nubbin of the debate was Steve's defense of not having to build optimizers anymore because the programmer would take care of it. That it was really a programmer's issue.... Seibel: Do you think C is a reasonable language if they had restricted its use to operating-system kernels? Allen: Oh, yeah. That would have been fine. And, in fact, you need to have something like that, something where experts can really fine-tune without big bottlenecks because those are key problems to solve. By 1960, we had a long list of amazing languages: Lisp, APL, Fortran, COBOL, Algol 60. These are higher-level than C. We have seriously regressed, since C developed. C has destroyed our ability to advance the state of the art in automatic optimization, automatic parallelization, automatic mapping of a high-level language to the machine. This is one of the reasons compilers are ... basically not taught much anymore in the colleges and universities." -- Excerpted from: Peter Seibel. Coders at Work: Reflections on the Craft of Programming "A consequence of this principle is that every occurrence of every subscript of every subscripted variable was on every occasion checked at run time against both the upper and the lower declared bounds of the array. Many years later we asked our customers whether they wished us to provide an option to switch off these checks in the interests of efficiency on production runs. Unanimously, they urged us not to--they already knew how frequently subscript errors occur on production runs where failure to detect them could be disastrous. I note with fear and horror that even in 1980 language designers and users have not learned this lesson. In any respectable branch of engineering, failure to observe such elementary precautions would have long been against the law." -- C. A. R. Hoare, Turing award lecture in 1981,
- SaxonRobber 7y agoThere are only two kinds of languages: the ones people complain about and the ones nobody uses.
- hugi 7y agoThis sentence has been used to justify so much evil in the world.
- SaxonRobber 7y agoI know C++ is a vile, but Bjarne only had the best intentions. Cut him some slack!
- pjmlp 7y agoThere is a third one, the ones that cause billions of monetary losses in fixing security exploits. It was a big mistake from US government to have forbidden Bell Labs to be able to sell UNIX on its early days. C only got widespread because it had a free beer compiler and OS to back on.
- SaxonRobber 7y agoToo bad the other dinosaurs didn’t catch on until it was too late and they died. (Or became zombies)
- pjmlp 7y agoYou mean like all modern C compilers are actually written in C++? Or that C hardly has a place on Windows, ChromeOS, iOS, macOS, Fuschia, Android, beyond legacy Win32/POSIX APIs?
- AnimalMuppet 7y ago> C has destroyed our ability to advance the state of the art in automatic optimization, automatic parallelization, automatic mapping of a high-level language to the machine. So C caused everybody to get a lobotomy? C caused all the existing literature to disappear? How did C do any such thing as this quote is saying? The only way the quote makes any sense is if C made people to decide that automatic optimization, automatic parallelization, and automatic mapping of a high-level language to the machine were not actually the direction that we should be going in. I deeply suspect the "We're on the right path; all those others are fools who have been led into temptation" view of the history of computing. Just because of how comforting it is to those on the minority path, it is suspect.
- ajna91 7y agoPeople have a tendency to justify the status quo, does that automatically make the status quo suspect as well?
- hhas01 7y agoC made mediocrity and unreliability the accepted standard. As parent says, C’s a great choice for writing OS kernels. It should have stayed there. Imagine if upon purchasing an automobile you had to agree that if the wheels fly off and the engine explodes and you all die horribly in a hurtling ball of glame, you (or your estate) have absolutely no rights to sue the manufacturer for that outcome. Look at the Ford Pinto, look at Merck’s Vioxx; look at every bit of employee and customer safety legislation written over the years and why it got written in the first place. Now go read your software EULAs, and explain to us how a culture of shameless recklessness borne on zero liability is so positive for progress again? As I’ve said before, geeks are not the only ones to blame for this, but they are the ones who actually enjoy it this way.
- hhas01 7y agoC is not good. At least, not in the way parent means “good”. C is this brilliant awful crazy-successful hack, yak-shaved into existence just to bootstrap an entire brand new OS (UNIX) in record time; subsequently Peter-Principled into domains it really has no business being in (basically anything userland). This is why, fifty years on, we’re still fighting memory corruption and security holes and generally doing an awful job of parallel computation and everything else C is not very good at. Everyone should learn C, if only to understand where we’ve come from, where we are now, and where we should be trying to go in future. Languages like Lisp and Forth and Smalltalk are fundamentally different beasts to Algol’s descendents. Most developers, having being raised in a pure C/Algol culture, give no thought to the base complexity and limitations inherent in those languages; they just assume that is how computation is. What the Lisps do is reveal all that complexity and limitations to be artificial constructs, imposed by the designers of those languages, whether as convenience to implementation (as in C, where features like flow control statements map closely to underlying machine instructions) or simply because that’s what they’re already used to (c.f. 90s scripting languages like Python and JavaScript, born on the back of mature, ingrained C culture). .. Here’s a question to get you thinking: Why do Algol family languages have hardwired flow control statements? Not because that’s how programming needs to be, but because that’s how they’ve always done it. Often there’s some special-case behavior involved, e.g. deferred evaluation of operands, as in the case of conditional (`if`) statement bodies, and hard-wiring that particular special-case into the language guts is a quick way of addressing that need. Heck, even traditional Lisps (1 & 2) are guilty of hardwiring hackery (don’t let its uniform syntax fool you: Lisp is ridden with special forms, including conditionals). You have to go to something like John Schutt’s Kernel language to see that problem solved correctly, by extracting the special-case behavior (lazy evaluation) into a general, reusable feature. Schutt calls it “vau”, but it’s just a way to dictate how and when arguments should be evaluated at the language level, instead of baking that behavior into the language implementation where it can be neither modified nor reused. What’s the upshot? Well, first, you realize that 90% of what Algol languages treat as core features aren’t “core” at all. They can be pulled out, generalized, and expressed as plain old composable functions. Suddenly your “core language” collapses from something big and complicated, with dozens of special-case features baked in, each with its own special syntax and behavioral rules, down to something ridiculously simple: an evaluator, a mechanism for composing behaviors (functions with vau support), and maybe some primitive datatypes to get you started (although even those can be pushed out into libraries if you want), … and that’t it. It is the mother of all refactorings, and it reveals the simple truth. All those features and complexity the Algols had us believe were essential prerequisites to computation and programming… all gone, pushed out to external libraries which the user can freely import, modify, replace, or ignore as they need. Once you realize how small, simple, and elegant computation can (and should) be, you’ll wonder what the hell all that vast intricate pomp and ceremony is really for, and who it really serves. Programming languages are big and complicated not because that’s how they need to be but because nobody tries to make them small and simple. But as Tony Hoare said: “There are two methods in software design. One is to make the program so simple, there are obviously no errors. The other is to make it so complicated, there are no obvious errors.” So if a language already falls in the latter camp, then Dog only imagine all the software subsequently written in it! This is where C falls outwith its original purpose, and it’s telling that subsequent popular attempts to fix it have done so by adding even more complexity on top, e.g. C++, Java, Swift. (It’s only recently with the likes of Rust that trend has started to reverse, but Rust is still a Complex language compared to a Forth or a Smalltalk.) .. Now, there is a tendency in Lisp circles to rave about macros as if they’re the True Revelation, but they’re not. The revelation is when you realize you have the ability to reshape a language you are given into the language that you need; a language that precisely and concisely expresses the concepts and behaviors that are of interest and relevance to you in your particular problem space. Lispers describe this as “bottom-up programming”, but the term hardly does it justice. Find yourself writing “if not TEST do ACTION” a lot? Extract that out into your own first-class “unless TEST do ACTION” command and use that going forward. Want to evaluate commands non-sequentially according to your own [e.g. priority-based] rules? Done. Don’t want loops? Leave them out. When you write an “Algol” program, the language always controls how your program is evaluated. If you don’t like the way it does it, tough. When you write a “Lisp 3” program, you get to control how your program is evaluated. You aren’t stuck with a fixed language-level set of first-class flow control statements that may or may not meet your needs, plus a weak second-class user-level mechanism for kind of creating your own (C-style functions, with their inherent limitations). There’s only one level: everything is a first-class feature, whether it’s provided by the language or added by you. .. We often think of C as a “general-purpose language”, but I think this is wrong and unhelpful. We should really think of C as a DSL, one created specifically for bit-twiddling and crude algorithmic number crunching (which is what it’s good at). The true general-purpose languages are the meta-languages, because they have the power to be whatever we want them to be. Working in C, you always speak in C. In a “Lisp 3”, you can speak in any language you like; you just have to grow that initial minimalist foundation of key building blocks into the language you want, and then off you go. It is the difference between Algorithmic Thinking and Compositional Thinking. Yes, algorithmic thinking has achieved a lot in the last 50 years, but the software we’ve built that way has a lot of problems—safety, reliability, scalability, learnability, verifiability—that I strongly suspect are inherent to that approach. We really need to try compositional thinking to escape that trap, but we can’t even start to do that while the languages we commonly use (Algol family) are themselves fundamentally crap at compositionality. -- Lastly, I think Nile (https://news.ycombinator.com/item?id=19844088 https://news.ycombinator.com/item?id=19844088) requires an honorary mention in parent’s list; not because of the language itself but because of how it’s constructed: not only is it a composed language, but the language it’s written in is a composed language too. If that doesn’t melt your mind at the possibilities, nothing will!