8 ms·
Other commenter's claim is inaccurate. I have a detailed history, with references, of how C became what it was: http://pastebin.com/UAQaWuWG http://pastebin.co
by nickpsecurity 11y ago
Other commenter's claim is inaccurate. I have a detailed history, with references, of how C became what it was:
http://pastebin.com/UAQaWuWG http://pastebin.com/UAQaWuWG
That its predecessor compiled on an EDSAC, it compiled on a PDP-11, and was the language of UNIX (its killer app) was why it spread everywhere. Network/legacy effects took over from there. There were languages like Modula-2 that were safer, efficient, easy to implement, and still close to the metal. Such languages kept being ignored and mostly are to this day for system programming. They even ignore the ones that are basically C with enhanced safety (eg Cyclone, Popcorn).
It's all social and economic reasons justifying C both at its creation, during its spread, and for its continuing use. The technical case against such a language has always been there and field-proven many times.
- scythe 11y agoHave you ever actually tried to write code in Modula-2? Has there ever been an efficient, portable implementation of Cyclone or Popcorn? Does anyone seriously consider either to be easy to implement? And, if you just randomly picked three examples, why are they all bad? What does that mean about the other examples, statistically?
- nickpsecurity 11y ago"Have you ever actually tried to write code in Modula-2?" Three people wrote a consistent, safer platform in it from OS to compiler to apps in 2 years. Amateurs repeated did stuff like that with it and its successors like Oberon for another decade or two. How long did the first UNIX take to get written and reliable in C? "Has there ever been an efficient, portable implementation of Cyclone or Popcorn? " I could've said that about C in its early years given it wasn't intended to be portable. Turns out that stripping almost every good feature out of a language until it's a few primitives makes it portable by default. "And, if you just randomly picked three examples, why are they all bad? What does that mean about the other examples, statistically?" It means that, statistically, the other examples will have most of C's efficiency with little to none of its weaknesses. People using them will get hacked or loose work less. Like with all safe, systems languages that people turned down over C. Least important, it means I picked the examples closest to C in features and efficiency because C developers' culture rejects anything too different. That includes better options I often reference. Why is that bad for their ability to produce robust programs? And what does that mean about C developers statistically?
- AnimalMuppet 11y agoHere's what's wrong with your whole line of reasoning. People wrote an OS in Modula-2? That's great. How many of them wrote an OS that people wanted to use? That's a considerably harder task, you know. It's not just that all OSes are equivalent, and the one with the most publicity or corporate support wins. In particular, I assert that Unix was considerably bigger and harder to write than those OSes written with Modula-2, in the same way that Linux quickly became much bigger than Minix. That "bigger" and "harder" isn't the result of bad technique or bad languages - it's the result of making something that actually does enough that people care to use it. Next assertion: C makes some parts easy that are hard in Modula-2. That makes it more likely that the harder parts actually get written, that is, that the OS becomes usable instead of just a toy. (True, C also makes it easier to wrote certain kinds of bugs. In practice, though, the real, usable stuff gets written in C, and not in Modula-2. Why? It's not just because everybody's too stupid to see through the existing trends and switch to a real language. It's because, after all the tradeoffs are weighed, C makes it easier to do real work, warts and all.)
- Avshalom 11y agoI dunno, I sure as hell never asked for Unix. That was a decision made for me by AT&T and it's monopoly a decade before I was born. As for why "the real, usable stuff" gets written in C? Because C is the only first class programming language in the operating system. And of course 20 years ago "the real, usable stuff" was actually written in assembly because C was slow and inefficient. Or Fortran if you needed to do any math more complicated than middle school algebra.
- AnimalMuppet 11y agoWell, the "decision" was actually the consent decree in the AT&T antitrust case, which said that AT&T couldn't go into the software business. (Note well that AT&T did not have any kind of a monopoly on computer operating systems - not then, and not ever.) The result, though, was that Unix became available for the cost of distribution plus porting, and it was portable. It was the easy path for a ready-for-real-work non-toy operating system on new hardware.
- googamooga 11y agoKronos, the Soviet 32-bit workstation, was designed and built from hardware to all compilers, OS and miscellaneous applications by a small group of students in a couple of years. The only language they used was Modula-2. [1] https://en.wikipedia.org/wiki/Kronos_(computer) https://en.wikipedia.org/wiki/Kronos_(computer)
- nickpsecurity 11y agoThanks for the link! Had no idea Russians built a Wirth-style system based on Lilith. There's almost a trend with them as they received the Oberons and especially Component Pascal better than most countries. My foray into Blackbox showed lots of Russian use. There have to be attributes of the language and tooling that appeal to Russian programmers more than others for whatever reason. I wonder what those are, both aspects of Russian style and language that appeals.
- pjmlp 11y agoIBM did. After Assembly, IBM used mostly Modula-2 and PL/M to write their mainframe OSes, e.g. OS/400, migrating the code slowly to C++ afterwards. Also OS research at DEC and Compaq was done in Modula-2+, which gave birth to Modula-3.
- nickpsecurity 11y agoThose mainframes and OS/400 were also very reliable and fast compared to the UNIXen. Hmm. Probably just a coincidence the C people will tell us. ;)
- cmrdporcupine 11y agoI did, as a teenager. The language was nice. The strong types did get in the way of interfacing with a lot of OS level stuff that wanted to deal in void pointers tho.
- nickpsecurity 11y agoMy strategy for that sort of thing was wrapping all the stuff in unsafe modules that exported safe API's. Just do some basic checks as function is called then messy stuff is handled in its own little file of scary code. I was doing this in other languages way after you were dealing with Modula-2 on even older hardware. So, I'm curious as to how you and others then handled that problem? What were the tactics?
- cmrdporcupine 11y agoI was too young and too distracted by the world of being young to focus on it enough back then to truly sit down and do that. By the time I got my Modula 2 compiler I was 13 or 14 years old and then high school happened and about 3 or 4 years later I had a PC running (pre 1.0) Linux, so. I never had to truly deal with it.
- nickpsecurity 11y agoOh OK. That's aight.
- SixSigma 11y agoThe irony too, that Ritchie, Thompson, Pike et al at the Unix labs were then enamoured by Modula-2 & Oberon and used the ideas to build plan9 but in a new version of C.
- nickpsecurity 11y agoThe wikipedia article says that, when designing Google's language, all three of them had to agree on every single feature so no "extraneous garbage" crept in. The C developers dream language was basically an updated Oberon. That's them dropping the QED on C supporters for me. :) Funny thing is, Oberon family was used to build both apps and whole operating systems. Whereas, Thompson et al's version is merely an application language lambasted for comparisons with system languages. I don't know if they built Oberon up thanks to tooling and such or if they've dropped back down a notch from Component Pascal since it's less versatile. Just can't decide. Note: Imagine where we'd be if they figured that shit out early on like the others did. We'd be arguing why an ALGOL68 language wasn't good enough vs ML, Eiffel DbC, LISP's macros, and so on. The eventual compromise would've been better than C, Go, or ALGOL68. Maybe.
- SixSigma 11y agoI still use Acme, a plan9 text editor that was based on Oberon and it is the best software ever. Just the notion that "all text is a potential action" blows all other usability notions out of the water. Want a drop down menu ? : make a file in the current directory with the name of the menu, put the commands in it you want in the menu. Done. And that can go as deep as you like. Those commands can include snippets of shell code that act on the current document e.g. | sed s/[a-z][A-Z]/g Highlight some text, middle click that command and the command runs on the selected text. Add to that a file system for the text editor : date > /n/acme/new execute that and you get a new document containing the date When using it, it feels limitless. You build a command set that matches your current project. There's a pattern matcher too: the plumber, so you can click somefile.c:74 and the editor opens that file at that line. so "grep -n someregex ???.c" and you get a list of clickable "links" to those files. When you browse the plan9 source code you might see the unusual void main(args) we follow that convention so one can 'grep -n ^functionname ???.c' and you get a source code browser I'll stop there, and I've only scratched the surface ??? means * - you can't type * . c without spaces in HN !
- zik 11y agoC was quite a few years before Modula-2. C was developed in 1972 and was heavily used in UNIX by 1973. Development of Modula-2 wasn't started until 1977 and it wasn't widely available until the 1980s.
- cmrdporcupine 11y agoBut C on microcomputers did not come any earlier than Pascal or Modula-2 compilers. My first compiler was Modula-2 on my Atari ST. But it was difficult to do much in it because so much of the OS documentation and example code was geared towards C. Also compiling on a floppy based system (couldn't afford a hard disk) was terrible.
- nickpsecurity 11y agoI had to do lots of transfers with floppies but never had to do iterative development on one. I feel for you, bro. :)
- pjmlp 11y agoBut quite a few years later than Algol and PL variants.
- nickpsecurity 11y agoPoint was we see two traditions developing: 1. Languages designed to be high-level, readable, optionally easy to compile, work with large programs, have safety, and compile to efficient code. 2. Two languages, BCPL and C, that strip as much of that as possible to compile on an EDSAC and PDP-11 respectively. Thompson and Ritchie along with the masses went with No 2 while a number of groups with minimal resources went with No 1 with better outcomes. At each step of the way, groups in No 1 were producing better languages with more robust apps. Yet, Thompson et al continue to invest in improving No 2. By present day, most fans of No 2 forget No 1 existed, push No 2 as if it was designed like No 1, and praise what No 2 brought us whereas it actually hampered investments No 1 enabled easily. Compiler, HW, and OS people should've invested in a small language from No 1 category as Wirth's people did. That Pascal/P got ported to 70 architectures, some 8-bit, tells me No 1 category wasn't too inefficient or difficult either. Just gotta avoid heavyweights like PL/1.