Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
Programming Idle

What Happened When Unix Co-Creator Brian Kernighan Tried Rust? (thenewstack.io) 58

"I'm still teaching at Princeton," 83-year-old Brian Kernighan recently told an audience at New Jersey's InfoAge Science and History Museums.

And last month the video was uploaded to YouTube, a new article points out, "showing that his talk ended with a unique question-and-answer session that turned almost historic..." "Do you think there's any sort of merit to Rust replacing C?" one audience member asked... "Or is this just a huge hype bubble that's waiting to die down...?"

'"I have written only one Rust program, so you should take all of this with a giant grain of salt," he said. "And I found it a — pain... I just couldn't grok the mechanisms that were required to do memory safety, in a program where memory wasn't even an issue!" Speaking of Rust, Kernighan said "The support mechanism that went with it — this notion of crates and barrels and things like that — was just incomprehensibly big and slow. And the compiler was slow, the code that came out was slow..."

All in all, Kernighan had had a bad experience. "When I tried to figure out what was going on, the language had changed since the last time somebody had posted a description! And so it took days to write a program which in other languages would take maybe five minutes..." It was his one and only experience with the language, so Kernighan acknowledged that when it comes to Rust "I'm probably unduly cynical. "But I'm — I don't think it's gonna replace C right away, anyway."

Kernighan was also asked about NixOS and HolyC — but his formative experiences remain rooted in Bell Labs starts in the 1970s, where he remembers it was "great fun to hang out with these people."

And he acknowledged that the descendants of Unix now power nearly every cellphone. "I find it intriguing... And I also find it kind of irritating that underneath there is a system that I could do things with — but I can't get at it!"


Kernighan answered questions from Slashdot readers in 2009 and again in 2015...

What Happened When Unix Co-Creator Brian Kernighan Tried Rust?

Comments Filter:
  • Seriously? (Score:4, Funny)

    by backslashdot ( 95548 ) on Sunday August 31, 2025 @01:40PM (#65628432)

    What kind of an idiot asks Brian Kernighan something like that?

    It's like asking Henry Ford what he thinks of the new Toyota.

    • Re:Seriously? (Score:5, Insightful)

      by Mirnotoriety ( 10462951 ) on Sunday August 31, 2025 @01:48PM (#65628452)
      There are no stupid questions. Brian Kernighan offers a unique historical and reflective perspective that few others can provide. Asking him about Rust or NixOS isn’t about a product review — it’s about insight into how the field has evolved. It’s less like asking Henry Ford whether he prefers a new Toyota, and more like asking him what he thinks of the evolution of car design decades after creating the assembly line.
      • At least for what TFS has included, I think he's just more of an old dude set in his ways on that. The semantic differences between C and Rust are huge (also as you might note in my signature, semantics is one of a few major differences between languages that extends beyond syntax, and the very much non-developer who claims to be a developer doesn't even know that -- notice for example that java has quite different semantics from C++, namely Java is mostly implicitly pass by reference, whereas in C++, refer

        • Er *ahem* pointers, rather than references, for those C developers that read my post.

        • For example in rust, passing a user defined struct as a variable is always a move unless otherwise specified, where in C it's always a copy.

          That's utter, abject nonsense. That kind of analyzing C through the lens of the lousy, parasitic concepts that Rust is dealing in is just like how the homeopaths are calling the actual, evidence-based medicine "allopathy".

          What would take to change something like
          struct { ... } foo; ... func(foo)
          in C from a "copy" into a "move" just by changing the "semantics" of the exis

    • So these things he says aren't true? He said that he was being forced to do memory safety when it wasnt even a concern and that the compiler was slow. Was he wrong about that?
      • So these things he says aren't true? He said that he was being forced to do memory safety when it wasnt even a concern and that the compiler was slow. Was he wrong about that?

        Yes. Unless all of your variables are floats and integers on the stack, memory safety is always an issue when you write code in C. (If all of his values were actually floats and integers on the stack, he would have had no problem writing the Rust code either.)

        • To be fair, memory safety is only an issue if your code has a bug. I just assumed he was writing a short inconsequential program that could be written without a leak.
          • by HiThere ( 15173 )

            He said it would have taken about 5 minutes in C, so I think you're right.

          • Or rather, that he was writing one that could be written with a leak. You can't access freed memory if you never free memory, and short programs can often get away with that.

          • To be fair, memory safety is only an issue if your code has a bug. I just assumed he was writing a short inconsequential program that could be written without a leak.

            Memory safety is a pain when you're asked to prove the correctness if your code.

            There are things like a subset of C such as MISRA C and static analysis tools that let you do some very limited checking. But it doesn't quite rise to the level of a formal proof.

            • by gweihir ( 88907 )

              You can reduce the parts were memory safety is a concern and encapsulate them. For example, put them into functions and assume them as correct for that proof. Then make very sure the functions are correct and not exploitable. Gives you only partial correctness, but still. One big problem is that some C coders like to use "clever" code. That type of code is rarely needed.

            • by AuMatar ( 183847 )

              And outside of a masters degree course somewhere, where has that ever been a thing? Formal proving of programs isn't something done anywhere. Even then its utility is dubious- "Beware of bugs in the above code; I have only proved it correct, not tried it." - Donald Knuth

          • by tlhIngan ( 30335 )

            To be fair, memory safety is only an issue if your code has a bug. I just assumed he was writing a short inconsequential program that could be written without a leak.

            It could also be that the tutorials for learning Rust simply ... suck.

            Maybe they were written for first time programmers, and he couldn't be bothered reading them because he had to wade through chapters of "this is how computers do numbers" stuff. But in doing so, he missed out on very important concepts to the language because they were buried

            • by gweihir ( 88907 )

              It could also be that the tutorials for learning Rust simply ... suck.

              Well, they assume a lot. I got through the start of one and thought that most people will fail to understand a lot of it. That alone makes it unsuitable as mainstream language. I did get all of it, but I have imperative, OO, functional and assembler language experience and I am an IT security expert. I still did not feel and desire to continue, it just looks like it makes everything harder with few benefits. At least if you know what you are doing.

        • Re: (Score:1, Interesting)

          by cardpuncher ( 713057 )

          One of the frequently-admired features of Unix is the fact that a lot of the basic utilities are filters - they take text on stdin and produce transformed text on stdout that can be fed to another filter in the chain.

          C is a really terrible language to use for text-processing, even more so once you move beyond ASCII. How it ever survived for writing such programs is actually quite hard to imagine. In fact, I can't really think of a use for which it is particularly suited - it doesn't give you the real contro

          • the familiar ideas of scope and lifetime that came from languages like Algol don't really apply and are hard to describe when there are asynchronous threads that may or may not also be running in parallel.

            The "nursery" paradigm can help to bring some sense of scope and lifetime back to a multithreaded task. See "Notes on structured concurrency, or: Go statement considered harmful" by Nathaniel J. Smith [vorpus.org] (8000 words)

          • C is a really terrible language to use for text-processing, even more so once you move beyond ASCII.

            Don't know why you were modded down because this is so true. The way C handles strings is pretty fly-by-night, which IIRC is something it inherited from its PDP-11 days. They're just character arrays that are terminated by a null character. That's it. There's no length indicator stored with it (i.e. no fat pointers) so you just keep reading unless and until there's a null character to tell it when it's done, which may or may not exist where you intended it to. There are so many ways this can go incredibly f

            • by gweihir ( 88907 )

              C strings are not intended for heavy lifting. If you do that, you are expected to use a string library or use your own approach.

          • by gweihir ( 88907 )

            Actually, C is pretty good for text-processing if you know what you are doing. Yes, it takes some more effort, but you get blazing speed and other advantages. Sure, if you just want to do some smaller things with text, do Perl. But forget about larger jobs that way.

        • by gweihir ( 88907 )

          So these things he says aren't true? He said that he was being forced to do memory safety when it wasnt even a concern and that the compiler was slow. Was he wrong about that?

          Yes. Unless all of your variables are floats and integers on the stack, memory safety is always an issue when you write code in C. (If all of his values were actually floats and integers on the stack, he would have had no problem writing the Rust code either.)

          That is some fine nonsense you have there. First, putting things on the stack does not protect them. Second, unless you do certain things in C it is actually memory-safe.

          • Scalars on the stack are "automatic" variables. There is no explicit memory management needed by the programmer. They are pretty safe, as long as you don't do stupid C casting tricks.

            The "certain things" you refer to includes using *any* pointer or array value in any way, including allocating, freeing, indexing and dereferencing. That essentially means any operations on items other than the automatic scalars I already covered. (For completeness, we can also consider "plain old data" structs lacking embedded

            • by gweihir ( 88907 )

              Scalars on the stack are "automatic" variables. There is no explicit memory management needed by the programmer. They are pretty safe, as long as you don't do stupid C casting tricks.

              I guess you never have heard of buffer overflows on the stack then ...

              • How are you going to get a buffer overflow on an integer or float scalar?

                Those happen on arrays and pointers, whether on the stack, heap or global static spaces. You can also overflow the entire stack using unbounded recursive function calls, but that's a different issue.

                Your seem to be totally ignorant about how different data types work.

          • Second, unless you do certain things in C it is actually memory-safe.

            So what are you saying, never mutate or free memory once it has been allocated?

      • Re: (Score:2, Interesting)

        Rust really shouldn't be treated as a general purpose language. It's a specialized language for special situations: when you want to get the absolute fastest performance possible, and you're willing to put in extra work to get it, but you don't want to sacrifice memory safety.

        For most code that most people write, you're better off using a language that gives up a little performance to get memory safety without the effort. There are lots of languages like that: Java, C#, Kotlin, Swift, etc. They give the

        • by HiThere ( 15173 )

          An interesting selection of langauges. I, personally, switch between C++, Python, and D, depending on what I'm doing. I find all of the ones you selected ... umm ... less suitable. I'd be interested in Go if Doxygen could handle it. Similarly for Ruby. Both have cases where they would be the better choice, but documentation of my work says to avoid them. (And Sphinx is lousy, but since Doxygen handles Python I don't need to deal with it.)

          • Wait, doxygen support? That's what determines your choice of language? I mean, that's a strong opinion.
          • C++ is an older language used for performance critical code. It isn't memory safe, which can lead to a lot of bugs. There are times when that tradeoff makes sense, but it's not the right choice for most projects today. And if you're starting a new project of that sort, consider whether Rust might be a better choice.

            Python is for code that isn't performance critical at all. If you write the same algorithm in all the languages we've mentioned, the Python version could easily end up 20 times slower than mo

        • For most code that most people write, you're better off using a language that gives up a little performance to get memory safety without the effort.

          Why do that when it just comes naturally to you? I'm asked to write a lot of python at work, occasionally golang, but for my personal projects my default choice is rust, even for little things. A lot of that comes down to rust's tooling being very top shelf, (honestly I think the thing I hate about Java the most is the tooling, which I probably spend more time fighting with than anything else in that language) but there are a lot of semantic bugs that will bite you hard at runtime that aren't even relevant

      • by gweihir ( 88907 )

        Probably not. I had a look at Rust and it just looked excessively complicated.

    • Re:Seriously? (Score:4, Informative)

      by BadDreamer ( 196188 ) on Sunday August 31, 2025 @03:18PM (#65628574)

      Asking Henry Ford about a car would indeed be rather daft. That would be like a lot asking Kernighan what he thinks about the the latest version of MS Office. It's not a very interesting topic to ask about.

      What was asked is more akin to asking Henry Ford about what he thinks about the Toyota car design and manufacturing process. And there he'd have a lot of interesting insight, comparing it to his sensibilities which were instrumental in kickstarting the modern industrial era.

      Kernighans experience of Rust illuminates some aspects of the modern development experience that are usually not made explicit. The developers who use the language are accustomed to it, and very few people come at it with the amount of experience Kernighan has. The objections to using the lamguage I have read from others have been a lot less articulate and succinct. And at the same time, his explanation tells me a lot about why these aspects are no issue to many others.

      • I bought "Java for C++ Programmers" and "Java in 21 days" back in the day.

        It took me probably a couple weeks to really get the hang of it to the point I was building message queues and passing objects among threads (a client-server app).

        It was probably only my 9th or 10th language at the time and quite different than some others I'd used.

        I've looked at Rust fundamentals and am currently waiting for the dust to settle. Odds are good that Java code I wrote in the 90's would mostly run today. Not interested

        • by gweihir ( 88907 )

          I wouldn't depend on somebody with less than three years of C to put a server on the wire.

          I would not depend on anybody with only 3 year of experience to write secure code in any language, period.

    • Re:Seriously? (Score:4, Informative)

      by ceoyoyo ( 59147 ) on Sunday August 31, 2025 @04:12PM (#65628680)

      I expect Henry Ford would have pretty insightful things to say about the new Toyota.

      Kernighan is an accomplished computer scientist who's written books about several languages, including the famous one he wrote about C.

  • Attention seeking behavior by pumping up the most trivial of things and events by the media and social media is a detriment to progress.

    Trying to boil the pot to pit us into "group x" and "group y" to get red-meat shouting matches on every area of life, technology, trend, whatever is not forward progress.

  • "And he acknowledged that the descendants of Unix now power nearly every cellphone. "I find it intriguing... And I also find it kind of irritating that underneath there is a system that I could do things with — but I can't get at it!"" - That's called lock-down enshitification for the sake of monetization. Tech bros are your gods and you need to bow to them accordingly.

    • The irony to me is Brian is a god in a way, and a kind one. The tech bro's you mention I doubt could code nearly as well as Brian and I'd not consider them gods. And as you say, they are not kind. The old guard that the entire underpinnings rest on were a pretty humble group.
  • by Viol8 ( 599362 ) on Sunday August 31, 2025 @03:25PM (#65628590) Homepage

    ... what he thinks of modern C++ where the learning curve for newbies is now getting close to vertical. Speaking as a C++ dev of 25 years I wouldn't go near the language now if I was starting out, the number of paradigms and syntactic complexity has become ridiculous. And yes, if you're going to work on code written by others you do need to know and understand all these paradigms.

    • by gweihir ( 88907 )

      Complexity kills. On language level just the same as on code level. One reason why applied CS/IT/coding is not a mature engineering discipline is that the tools are not mature and often massively to complex to understand.

  • by BadDreamer ( 196188 ) on Sunday August 31, 2025 @03:39PM (#65628624)

    In a podcast in 2022 Kernighan mentioned an experience with Rust, and it appears to be this one. At that time he considered it too brief to have much of an opinion on the language, and apparently it was already a while back, when the language was changing very rapidly and not yet very popular.

    He didn't mention the issues he took up this time either. The discussion went in many directions, but it's a bit strange he didn't bring up more of what he experienced at that time, especially since the focus of the podcast was on what has changed in the fifty years since he started out with C and UNIX.

    https://changelog.com/podcast/... [changelog.com]

  • "It wasn't finger lickin' good," said Sanders, "and it only had 9 herbs and spices instead of 11 like my chicken."

    All in all, the Colonel had had a bad experience.
  • I remember that 30 - 35 years ago, during CS classes at university, we used to switch our minds from a language to another, from course to course: ADA, C/C++, Smalltalk, Prolog, Lisp ...
    But in the last few years, I tried the Rust tutorial. Two times. I failed. My brain cannot cope with the syntax. It's way to close to C/C++, but with different and new meanings.
    I think "I'm too old for this shit" ...
    I find confort telling me that the younger coders need sidekicks to hide low level considerations.
    But I ma
    • I took a CS class also eons ago. Covered APL, PL/I, ALGOL, SNOBOL, LISP, and I think a couple others. Prof was great, would identify how they were different in a clear way, and give us an assignment or two to demonstrate those differences. Not much depth on any one, but more depth on how/why choices were made in the various languages. And back then, things like LISP and APL were monsters in terms of compute/memory requirements to do anything of significance.
    • I am not comfortable with Rust, but I can kind of work it out (it's part of my job now). But I'm lost when I face a Haskell program that I did not write myself.

      I think some languages are so similar that it's not too much trouble to switch between them. That was the cast for me with Pascal and C, and to some degree between C and a decent macro assembler from the 1990's.

      Other languages are so naturally intuitive or so like a formal algebra subset that they are not too difficult to pick up. Such as the case wi

  • And who cares if there is no one person who can code anything in the Linux kernel--most of us. Why not fork Linux and do whatever the hell you want?
    • Some people do that. Quite a few start their own kernel projects which usually run out of steam. I think if you want to be part of a massive community, you're going to be going with a mainstream kernel like Linux or FreeBSD.

      If you want to do kernel development without having to learn Rust, then FreeBSD is an option currently. Although there are proof of concepts for writing kernel modules in Rust for FreeBSD, it hasn't quite taken hold of that project like it has for Linux.

  • There are a couple of odd postings here about C being deficient
    for string-handling. Unless you are talking about comparison with
    SNOBOL, C is wonderful for strings!

    E.g. for Berkeley Unix, I jammed in C/shell-based code 'locate'
    (née 'fastfind') for file finding, non-numerical code for LZW-based 'compress',
    and GNU [ef?]grep for hybrid Boyer-Moore regexp search, and did
    samizdat work on fast anagram generation (see Scientific American
    for October 1984). Some of it is still around or is otherwise
    runnable on

Why don't you fix your little problem... and light this candle? -- Alan Shepherd, the first man into space, Gemini program

Working...