1. 15
  1.  

  2. 10

    That means these people must be living on an oasis with their fast compiles, enhanced safety, and nice GUI. All using an extension of a language from the 1970’s.

    Outside ALGOL-like languages, there’s two others built on tech ranging from 1950’s-1980’s whose productivity runs circles around C as shown in second link. Corroborates every other study I’ve ever seen, too. The language family in first link can use C libraries, compile to C, extend C with their macros with generation of legacy C, easily add optimization/security since they’re ideal for compiler writing, and so on. They give you all C’s benefits easily but doing it the other way around is hard. And lets not forget vulnerabilities that come with C code most of the time: vulnerability is something C coder’s often embrace even when it’s unnecessary.

    Embracing vulnerability by default on a desert island means their island will perish due to preventable disaster while others continue on getting through their smaller struggles. Given the amount of legacy and new C, maybe this desert island analogy isn’t fitting well with reality. ;)

    1. 8

      It’s astonishing how Pascal is downplayed in these blog posts. Sometimes with a reference to “why c is not my favourite language”. These blog posts compare today’s c to 1970s Pascal typically. Not a fair comparison (evident when the article makes the point that Pascal does not have function pointers, turbo Pascal/free Pascal do have function pointers, I used to write WinAPI software with freepascal).

      The blog article talking about the simplicity’s of c or writing a c compiler is absurdly wrong. As an evolved language it is complex.

      You mention common lisp, Smalltalk and pascal as alternatives. I would also like to mention Oberon which has lately caught my interest. The Oberon language is a descendent of the original pascal (not Borland style) and has a simple grammer with under 40 production rules. The Oberon system is a very interesting project.

      Anyway, most of these blog posts fall silent on the programming language dynamics with regards to platform effects. That Unix and bsd are c-based has paved the way for C.

      1. 2

        Exactly. They’re false comparisons. If you like Oberon, check out the later language Component Pascal with Blackbox and Astrobe Oberon for embedded.

        Edit: @emys I added links to them since Im on lunch now.

        1. 2

          My current pet project is writing a component pascal compiler actually 😉

          1. 0

            Ain’t that a nice surprise! Although I favored Modula-3, Component Pascal was another that had a nice simplicity vs power tradeoff. What made you choose Component Pascal specifically? Also, when I first searched for it, I found a lot of Russian results. Looked like it was popular over there at least at that time. Have you noticed any such patterns on forums or mailing lists of its few adopters?

            While we’re at it, I’ll throw out an idea that you may or may not be into for that project. The strength of C’s ecosystem and legacy effects mean plugging into it seemlessly with max compatibility is best way to pull more people out of it incrementally. I’ve been suggesting that, at a minimum, new languages keep its data types and calling conventions. Then, make FFI pull it in as automatically as a C program can. Then, ability to export functions to be called by C programs normal way. You get maximum, high-speed compatibility with C libraries that way,

            What would you think of a component Pascal that builds on C compatibility at that low-level but otherwise goes with Wirth tradition of safety, simplicity, and fast compiles?

            1. 2

              I learned programming with Turbo Pascal books from our local library (I used Free Pascal quite early I think back when it had real). I had tinkered with QBasic, C and C++ before, but I wasn’t even a teenager then and learning to program already was a language barrier (native German, when we learned the word if in our english class at school I already knew it from programming books). With Pascal it made click, I could understand the error messages, structure my code, etc. So I guess I’ll always have a soft tooth for Wirthian languages.

              For some time the wish in me is growing to write a compiler or interpreter. In the beginning I contemplated a lisp or a Smalltalk. Then I didn’t want to start writing my own virtual machine and my focus shifted a bit on compiled languages. I remembered pascal and wanted to read up on various pascal dialects, when I stumbled over the Wikipedia articles, read Modula -> Oberon and stumbled over Component Pascal which seemed like a nice idea because it has a concise spec that is available online (Oberon and Modula I think are rather defined in published books that are long out of print). Also I am curious how programming with Oberon feels like, especially the reflection feature and the With-statement seems like a nice low-level substitute for Rust or Haskell style union data types.

              This is not my first try at writing a compiler nor writing an interpreter, before I tinkered with Haskell and Parser Combinators, etc. Always getting lost in the way. This time I want to go the classical style and hand-roll lexer and a recursive descent parser to train my brain to think in terms of production rules. Wirthian languages seem like especially good for that. Not yet decided how I will generate code, probably I’ll use LLVM, but hand-rolling amd64 code OR maybe RISC-V is not off the table. Probably I will make a decision about this when I have an AST. Let’s see how I advance given that I don’t have too much time for side projects currently.

              What would you think of a component Pascal that builds on C compatibility at that low-level but otherwise goes with Wirth tradition of safety, simplicity, and fast compiles?

              Very much my idea of how it should work. imho Pascal was quite similar in that respect (except for the calling convention).

              You mention you like Modula-3 more than the Oberon family. What are your reasons for this? One thing I am missing with Oberon is that there is no concurrency story.

              1. 1

                Thanks for the story. Fascinating! I started with QBasic, too.

                Far as Modula-3, check out its Wikipedia page. Languages like C were small, unsafe, fast, snd harder to do large programs in. The safer languages for large programs like C++ and Java were enormously complex. Slow abstractions for most, too.

                Modula-3 gives you programming in large, concurrency, partly-verified stdlib, still smallish language, and still fast compiles (esp vs C++). I think it just struck great balance among many attributes that conflicted. Main thing it’s missing is Scheme-like macros. A must-have for Modula-4.

                1. 1

                  Thanks for the story. Fascinating! I started with QBasic, too.

                  Far as Modula-3, check out its Wikipedia page. Languages like C were small, unsafe, fast, snd harder to do large programs in. The safer languages for large programs like C++ and Java were enormously complex. Slow abstractions for most, too.

                  Modula-3 gives you programming in large, concurrency, partly-verified stdlib, still smallish language, and still fast compiles (esp vs C++). I think it just struck great balance among many attributes that conflicted. Main thing it’s missing is Scheme-like macros. A must-have for Modula-4.

        2. 3

          …these people must be living on an oasis with their fast compiles, enhanced safety, and nice GUI.

          C also has very fast compiles and these days people have a range of good GUIs available. Safety… not so much.

          …there’s two others built on tech ranging from 1950’s-1980’s whose productivity runs circles around C…

          Notably productivity isn’t mentioned in the article at all. C’s never made great claims to productivity as an application programming language but in my experience it’s not terrible either. lisp and smalltalk may make these claims but they’re also terrible resource hogs compared to C. C’s niche is tight control over the machine and its resources. Each language has its place.

          1. 2

            “C also has very fast compiles and these days people have a range of good GUIs available”

            Like in Turbo Pascal, optimized versions compiled at what seems today an insane speed on devices pre-Pentium. Does C compile that fast on a 100-200Mhz processor or even today’s devices single-threaded? An entire project done before your finger changes places? I used to do that in a BASIC, too. Hit a button, one second passes, and my next iteration is loaded with everything still fully in my head on a P3 400Mhz w/ 128MB RAM.

            “lisp and smalltalk may make these claims but they’re also terrible resource hogs compared to C. “

            Maybe terrible LISP’s. I’ve seen benchmarks where many are quite fast. There’s also been soft, real-time deployments of them. Chez Scheme’s first version started on a Z80 per this account. Most C coders probably would crash that with their bloated apps. Then, there’s an idea I had which I fortunately found had been done in ZL of C and C++ integrated with Scheme to get benefits of both. So, your stated LISP drawbacks and C advantages are nullified by the fact that LISP can do what C can with LISP’s benefits and export the result to C like PreScheme did. Doing that in reverse? Much harder and messier.

            “C’s niche is tight control over the machine and its resources.”

            Quite a few languages can do that. PL/S, Ada, Amiga-E, the safer C’s (eg Cyclone), D, SPARK, Rust, Nim, ZL, ATS, Ivory, Myrddin, and Zig come to mind. Most don’t have the drawbacks of C in average case. Some are more flexible, predictable, optimizable, or safer than C in the low-level cases. Seems like C is most popular and deployed but not strongest in that niche along a number of dimensions.

            1. 3

              Does C compile that fast on a 100-200Mhz processor or even today’s devices single-threaded?

              Turbo Pascal’s great. In the end compilation speed’s an implementation detail and there are plenty of fast C compilers out there. ZapCC comes to mind.

              Most C coders probably would crash that with their bloated apps.

              Ok, that’s just your biases showing. There’s no valid reason to believe that C programmers are inherently creating “bloated apps” when lisp/smalltalk programmers aren’t.

              Correct me if I’m wrong but I believe lisp and smalltalk use garbage collection which makes them inherently less resource efficient than C. Again, that’s not necessarily a bad thing - each language feature has advantages and disadvantages - but memory efficiency isn’t as good for languages which have GC because collection inherently always lags last use to some extent. In C you don’t incur runtime costs for memory lifetime management so on that point alone C is more resource efficient. And there are plenty of other areas where these more abstract languages incur significant overhead where C doesn’t.

              Show me a lisp/smalltalk which can create programs for a PIC16F84 microcontroller. That MCU has only 68 bytes of RAM and 1.75KB of program memory. That’s not 68 KB or 68 MB of RAM. It’s 68 bytes. It’s no big deal to write C programs for such a resource constrained environment. lisp/smalltalk are completely out of the question though.

              At this time you also can’t write a program in PL/S, Ada, Amiga-E, D, SPARK, Rust, Nim, ZL, ATS, Ivory, Myrddin, or Zig for the PIC16F84 for a few reasons but not least because no compilers exist for these languages which can target such resource constrained MCUs. I only quote this MCU because it’s one of the smaller devices I’ve programmed. The same efficient resource handling applies for any other target of course. C remains unparalleled for its precise handling of resources in real world applications.

              Side note: you could probably write a FORTH which would run on the PIC16F84 but that’s about the only other language which could target it, I think. And it’d be a lot slower than C on this underpowered CPU.

        3. 6

          We could probably retitle this more like: Rob Pike and others stuck on some weird Unix-based desert island, get comfortable programming in C.

          This article misses the athropology of systems, products, and programming, which makes the assertions about C being “a near-perfect balance of vital language features” difficult to take seriously. Especially when they talk about how browsers use C++ (it’s almost like they weren’t designed in the 80s!) and refuse to mention how all mobile software written today basically avoids C like the plague. Or that web programming is largely Javascript.

          Programming languages are largely selected by what ecosystem/platform they’re writing for, and the cultures that made those platforms. People keep attempting to be the freakonomics of software engineering, but at least the economists are ridiculed for their lack of research.

          @nickpsecurity already posted a blog post here which has a reference to Capers Jones’ productivity research as to why even looking past these issues, this article is also just factually wrong in many of it’s assertions, so I won’t repeat it here.

          1. 3

            refuse to mention how all mobile software written today basically avoids C like the plague. Or that web programming is largely Javascript.

            Is that good?

            1. 11

              Whether it’s good or not is unrelated to why peolpe are using those languages - they are using them because of the culture and platform they operate in.

              Saying that Rob Pike, Linus Torvalds, and Dennis Ritchie agree that C is great is like saying everyone in a baseball stadium agrees that baseball is one of the greatest sports of all time.

              1. 2

                Well, mine was not the most serious comment in the world, but if you want to be serious: all the obvious flaws in C don’t make it any better that so much code is being generated without design or verification, using improvised languages that encourage sloppy code.

          2. 4

            Is “Middle C” a music reference or a Tolkien reference?

            1. 3

              Did anyone see a reference to when this was published? The alternatives you’re comparing C to were different in 2005 than they were in 2015.

                1. 2

                  Ah, thank you for kindly lgtfy’ing me :)

                  1. 1

                    Np, you made me curious :)

              1. 4

                In 2246, humanity will be long dead, Go and Python will be but memories, Haskell a mythical beast…and the heirs of the Earth will still be writing in C.

                (And Microsoft will still be working on getting C99 fully supported in Visual Studio…)