Hacker News new | ask | show | jobs
by nickpsecurity 3704 days ago
That's different. It means C is the most popular language in system programming. Makes so much sense when I explain above that C's prevalence is due to social and economic reasons given you argued it won a popularity contest. Hillary and Trump are also winning those right now if you want to argue how logical correctness and utility are connected to popularity. ;)
1 comments

>That's different. It means C is the most popular language in system programming.

And the basis upon which computing sits upon.

Take away all C/C++ code and we have nothing or almost nothing.

Take away all Lisp/Scheme code and people will barely notice.

>Makes so much sense when I explain above that C's prevalence is due to social and economic reasons given you argued it won a popularity contest.

If by economic you mean "pragmatic" and "engineering considerations", then yes.

"Take away all C/C++ code and we have nothing or almost nothing."

In that meaning, it's true but only as an accident of history that has little to nothing to do with C's design itself.

"If by economic you mean "pragmatic" and "engineering considerations", then yes."

BCPL was whatever compiled on a machine from the 1960's. C was what compiled on a machine from the 1970's. ALGOL was engineered. C was what compiled and ran fast on old hardware. That's it.

http://pastebin.com/UAQaWuWG

The rest was social factors. Even when alternative languages did better, most people didn't adopt them. Most buyers also paid for performance per dollar totally ignoring reliability, security, maintenance, and so on. Unless you argue these don't matter, then the dominance of C and UNIX is once again due to something other than their technical merits. Plus, the fact that their problems stayed in... intentionally... once better hardware came online while other players fixed them in various ways.

>In that meaning, it's true but only as an accident of history that has little to nothing to do with C's design itself.

I don't believe that for a second. C had very specific performance and memory characteristics that alternatives didn't have.

>C was what compiled and ran fast on old hardware. That's it.

That's a HUGE pragmatic benefit, not a "historical accident".

If C was made a decade later, we'd have been using Pascal or BCPL or something. Other stuff could do the job. Example: Hansen later put a Pascal variant, Edison, on the same machine thst was simpler, safer, and faster to compile. Pascal itself was ported to 70+ architectures from mainframes to 8-bitters.

Nah, we didn't need C. Thompson just really liked BCPL. It was crap. So they tweaked it into C. It still couldn't write UNIX. Ritchie added structs and that version finally did the job. All in the papers I cited. It's facts in their own writings and predecessor papers (eg BCPL) why each decision was made.

>Nah, we didn't need C. Thompson just really liked BCPL. It was crap. So they tweaked it into C. It still couldn't write UNIX. Ritchie added structs and that version finally did the job.

Well, Pascal was also inspired by languages that were crap compared to modern (70s/80s needs), and early Pascal's also had tons of missing features -- so I'm not sure what this "C wasn't good enough from the start" is supposed to mean, especially since C already had structs and all by the time it caught on.

You should read the history. Compare it to how ALGOL68 was made and what it offered. One looked at all the needs and common situations programmers ran into then engineered a solution to that in the form of a language. It balanced maintenance, efficiency, and safety.

One group tried to implement a version of it, CPL, on horrific hardware in batches on punchcards. Not best way to do state-of-the-art language compilers. Upon failing, they applied this method to CPL: chop off a feature, try to finish compiler, repeat. Result was easiest features to implement on a 1960's EDSAC in form of BCPL. Thompson preferred it over alternatives and tweaked it to his preferences, including assignments from := to =. Admits he just liked that better. That's the amount of science that went into his modifications.

Eventually, Ritchie tweaking it a bit, they got their toy OS to run on a toy machine. Many design decisions they made were due to its own design and limitations. Then, after UNIX spread everywhere and many apps were made, they just kept all that because fixing it would break something. That's the opposite of engineering a good system language. It's an acceptable, but not ideal, hack to make their crappy computers work. After they got better ones, they should've started migrating toward something better incrementally. They didn't and many defended the language as if it was designed well upfront instead of what compiled on an EDSAC and PDP. Facts don't lie.

Plenty of better stuff and techniques. For example, MULTICS project that gave them OS and BCPL experience had critical stuff in PL/0. In MULTICS, a microkernel, prefixed strings, and a reverse-flowing stack would've prevented tons of data loss and hacks that happened in UNIX. Why didn't they use those? Hardware expected a bad stack and other two techniques were too slow on it. Once hardware sped up, they kept the bad techniques to not rewrite stuff. I mean, this shows up over and over in UNIX/C. Its history really defines it.

Now, stop and go look at Modula-3 on Wikipedia. A few of us think it was one of best compromises between a safe, C alternative like Modula-2 and a heavyweight, ALGOL or C++ alternative. It was the product of professionals engineering, as done for ALGOL, an industrial language based on Wirth's prior work. Simple syntax that compiles fast as Go, a Wirth-style language. Has safety by default with off button where necessary, has basic OOP, has GC by default with off button for specific variables, built-in concurrency, mathematically verified stdlib (partially), runs efficient code, and was used for an OS (SPIN) w/ type-safe linking of 3rd-party code into kernel.

So, we know it could've been done better if it was engineered or addressed more programming needs than runs fast on 1960's hardware. Unfortunately, that's basically all BCPL and C did while ignoring good techniques then and later. Fortunately, we can learn from their mistakes for use in new languages or projects. :)

> And the basis upon which computing sits upon.

How does being the basis follow from being popular

> Take away all C/C++ code and we have nothing or almost nothing.

We had Lisp machines in the 70s, Oberon system in the 90s, Forth systems basically throughout history... take away C and C++ and something else would've become popular. Probably Pascal, some random low-level Lisp dialect, or Forth, given that those were all reasonably popular in a similar timeframe as C. For something that is a ‘basis’, C had an awful lot of competition.

> Take away all Lisp/Scheme code and people will barely notice.

Well, aside from every Emacs and AutoCAD user in the world.

Also HN wouldn't exist, so there's that.

>How does being the basis follow from being popular

The basis is by definition popular.

If it's not popular (at least where it matters) it's not the basis. Basis is the fundamental thing on top of which something (the IT world as we know it) stands.

One could argue that algorithms are more basic, but we're talking about programming languages here, and at that level, C/C++ has been, and remains king for anything crucial. Even Java, the CLR and V8 are written in C/C++ (to name but a few environments standing on this "base").

>We had Lisp machines in the 70s, Oberon system in the 90s, Forth systems basically throughout history... take away C and C++ and something else would've become popular. Probably Pascal, some random low-level Lisp dialect, or Forth, given that those were all reasonably popular in a similar timeframe as C. For something that is a ‘basis’, C had an awful lot of competition.

Not sure how this argument is supposed to work.

To be the basis of something doesn't mean you don't have competition. Just that you prevailed over it.

>Well, aside from every Emacs and AutoCAD user in the world. Also HN wouldn't exist, so there's that.

Still people would barely notice. If you think Emacs and AutoCAD would make a huge difference to the world if they disappeared (compared to say, Windows, Linux, Android, or, if we're to talk about sites and apps, Google, Facebook, Photoshop, Word, etc) then you've been on an echo chamber for too long.

(Not to mention that most Emacs users use it for if not C/C++ then for languages whose compilers are written with C/C++, on OSes written in C/C++, and that Emacs itself is written in C -- the base were elisp stands on is C).

> If by economic you mean "pragmatic" and "engineering considerations", then yes.

C didn't won because of "engineering" or "pragmatic" reasons, it won because it run faster on cheap hardware, which was a big selling point. It wasn't a pragmatic choice, but a stupid and short-sighted one - but those tend to usually win. Computing in the last 30 years was done in spite of, not because of, C.

An hardware more powerful than Burroughs machines from 1961, which were happily working with a safe systems programming language based on Algol.

Given that I remember the days junior Assembly developers could easily outperform C code, I don't agree with that point.

I bet if it wasn't for the rise of free UNIX clones, C would already be sharing drinks with Pascal at some retirement home.

Did I ever tell you about the OS that was written in FORTRAN? Here it is in case I forgot:

https://en.wikipedia.org/wiki/PRIMOS

That's a CPU and OS for Fortran. I found a web framework for Fortran, too. Today, we could do Hacker News in FORTRAN from the metal up. We'll leave that monstrosity to our imaginations, though. Not even that. ;)

>C didn't won because of "engineering" or "pragmatic" reasons, it won because it run faster on cheap hardware

Isn't that the very definition of an engineering/pragmatic reason?

> And the basis upon which computing sits upon.

No, C is the basis of a lot of programs. It is not, nor could it be, the basis of a sane system of computation.

That's an "moral" style judgement.

From a pragmatic perspective computing is just "a lot of programs".

It's not what "should be" -- it's what it is.

No, computation is a mathematical discipline; the lambda calculus is one way of thinking about computation (I won't say it's the best, but it's a way) which is part of that discipline; C simply … isn't.

Common Lisp, of course, is a hell of a lot more than just the lambda calculus, but it's also a hell of a lot better a language than is C.