• sith@lemmy.zip
    link
    fedilink
    English
    arrow-up
    9
    arrow-down
    15
    ·
    edit-2
    24 hours ago

    My gut tells me that any benefits of adding Rust is massively negated by the addition of a second language.

    If one wants to write Rust, there is always Redox and probably a bunch of other kernels.

    I like Rust, but it’s for sure an over hyped language. In a year or two, people will push for Zig, Mojo or some new pure and polished functional low level language. Maybe a Scheme or a Lisp? That seems to be what the cool kids use nowadays.

    Or maybe we’ll just replace the kernel with an AI that generates machine code according with what should be your intention.

    • Yozul@beehaw.org
      link
      fedilink
      arrow-up
      6
      ·
      21 hours ago

      I dunno, people have been saying Rust will go away in a year or two for, like, five years now. This feels different to me. I could easily be wrong, but I don’t think it’s just another fad language.

        • Yozul@beehaw.org
          link
          fedilink
          arrow-up
          1
          ·
          21 hours ago

          Well, go away was maybe not exactly the correct term, but come on. You know what I meant.

          • sith@lemmy.zip
            link
            fedilink
            English
            arrow-up
            1
            arrow-down
            1
            ·
            20 hours ago

            My point is simply that it’s probably not worth it to add another language. Doesn’t have anything to do with Rust really.

            Though I do think that the language is a bit over hyped. It’s obvious companies and projects used to say they’re using Rust, not just because they want to attract young developers or like the language, but because it’s a way to get VC. Like AI and blockchain.

            I do like Rust. But mostly because it encourages functional style programming. And the tooling is of course awesome. Especially compared to C and C++. However, I do believe that static pure functional languages are superior to Rust.

    • zalgotext@sh.itjust.works
      link
      fedilink
      arrow-up
      6
      arrow-down
      1
      ·
      22 hours ago

      C’mon man, this is just a textbook fallacious slippery slope argument. Rust isn’t some brand new language whose stable release was less than a year ago, it’s over a decade old now. Scheme and Lisp are interpreted languages for God’s sake, it’s borderline* impossible to use them for kernel programming.

      Also I’m pretty sure the whole point of the Rust project that all this drama is centered around is to keep Rust code separate from the kernel. From what I understand the whole point is to maintain Rust bindings to the kernel API as a separate project, so that if developers want to write a driver in Rust, they can without having to rewrite those bindings themselves. But the kernel code itself will still be all C code. Now I’m not a kernel developer, and the last time I wrote a driver was for my operating systems class in university over a decade ago, so take that with a grain of salt.

      * I say borderline because anything is possible with code if you’re creative enough, but anyone trying to submit Scheme or Lisp code to the Linux kernel is gonna get laughed off the Internet

      • sith@lemmy.zip
        link
        fedilink
        English
        arrow-up
        1
        ·
        20 hours ago

        I don’t think you get my point.

        Of course I don’t mean that you should introduce Lisp or Scheme into the Linux kernel. However, I don’t rule out anything when it comes to the future of programming. Kernel programming isn’t that special. If you need to make a scheduler, dynamic memory manager or an interpreter, as part of the kernel, because it solves your problem, you do it. Maybe you want the kernel to generate thread optimised FPGA and micro code on the fly? And this is done with some kind of interpreter. Who knows.

        My point is that it’s probably a bad idea introduce any new language into the kernel. A new backwards compatible version of memory safe c might be a good idea though. If it can be done.

        Haven’t touched the Linux kernel in 10+ years, but my guess is that a good approach is to write a new micro kernel in Rust. One that is compatible with most existing drivers and board support packages. And of course it has to maintain the userspace ABI and POSIX yada yada. Probably what the Redox project aims for, but I don’t know.

        Keeping the Rust bindings in a separate project might be unnecessary though. I’m sceptic about allowing upstream drivers written in Rust just because I find that there is such a great value in sticking to one language. I also know that many kernel developers are getting old and it gets harder to learn new languages the older you get. Especially if the language comes with a decent share of sugar and bling (the minimalism of lisp and c is valuable).

        If there is a problem finding driver developers that want to write C code, then sure. But breaking the flow of the senior maintainers/developers likely isn’t worth it. Unless they ask for it.

        And also, I really haven’t been following this Rust in the Linux kernel debate.

        • barsoap@lemm.ee
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          19 hours ago

          Any language containing eval in its spec cannot be (fully) compiled ahead of time, you’ll need interpretation or JIT.

          Also last I checked (it’s been a while) Racket compiles to bitcode and then links in a bitcode interpreter. There’s static lisp/scheme compilers but when they come across an eval, they’re going to bail and compile in a JIT compiler or interpreter to deal with that stuff.

          • boonhet@lemm.ee
            link
            fedilink
            arrow-up
            1
            ·
            8 hours ago

            Fair enough, but you COULD create a compiler for a a subset of the language without eval. There are so many dialects of Scheme, what’s one without eval? Evals are very much evil anyway.

            • barsoap@lemm.ee
              link
              fedilink
              arrow-up
              3
              ·
              7 hours ago

              There’s plenty of schemes that aren’t fully standards-compliant but I don’t think leaving out eval is common – it’s easy to implement and nothing about the standard says that it needs to run code fast.

              Just wanted to point out that eval is the real static vs dynamic boundary. As to evil, sure, you shouldn’t run just any code you find without having a sandbox in place, C’s way to do the same thing is to call cc followed by dlopen, that’s way scarier, which is why people just link in lua or something instead. I guess in <currentyear> you should probably include a wasm runtime instead of using dlopen.