• pheggs@feddit.org
    link
    fedilink
    English
    arrow-up
    12
    arrow-down
    10
    ·
    2 days ago

    not a big fan of rust personally. I think it would be much smarter to bring borrow checking to C through annotations. That way we would not have to rewrite the whole world

    • Oinks@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      10
      arrow-down
      1
      ·
      edit-2
      1 day ago

      No C program is written to satisfy a borrow checker and most wouldn’t compile with one, so adding it would require rewriting the world anyways. At that point why not choose a language that, in addition to being memory safe, also drastically cuts down on other kinds of UB, has sum types, sane error handling, a (mostly) thread safe standard library, etc.?

    • originaltnavn@lemmy.zip
      link
      fedilink
      arrow-up
      15
      ·
      2 days ago

      While I agree that would solve much of the motivation behind rewriting in rust, I don’t think it would bring many of the rust-enthusiasts over to C. For me at least, the killer feature of rust is having a modern tooling and language with proper library management, functional stuff in the language and one language standard everyone agrees upon.

      • Kushan@lemmy.world
        link
        fedilink
        English
        arrow-up
        15
        ·
        2 days ago

        I don’t think it’s about bringing rust enthusiasts to C, it’s about the fastest way to bring more safety to the entire ecosystem.

        I’m not convinced it’s possible with just annotations, mind.

        • pheggs@feddit.org
          link
          fedilink
          English
          arrow-up
          3
          arrow-down
          2
          ·
          2 days ago

          It is possible, it would bring in quite a few restrictions though. The bigger problem I see is that it wouldn’t be entirely clear as an end user whether a program is memory safe or not. However, this isn’t the case with rust neither. Maybe some kind of certification would help

      • pheggs@feddit.org
        link
        fedilink
        English
        arrow-up
        2
        arrow-down
        1
        ·
        2 days ago

        Yeah, I don’t think there’s anything wrong with coding in rust for people who like it. But I do think it’s quite a bit of useless work that could be spent more wisely on new products instead of rewriting things that we already have

    • jkercher@programming.dev
      link
      fedilink
      English
      arrow-up
      8
      ·
      edit-2
      2 days ago

      I don’t think you would get much traction on C developers’ existing projects. C gives you the option to do everything your way. If the developer’s paradigm doesn’t agree with the borrow checker, it could become a rewrite anyway.

      Most projects don’t use the newer c standards. The language just doesn’t change much, and C devs like that. This might get a better response from the modern C++ crowd, but then you are missing a large chunk of the world.

    • stingpie@lemmy.world
      link
      fedilink
      arrow-up
      10
      arrow-down
      4
      ·
      edit-2
      1 day ago

      I struggle to learn rust because the semantics and syntax are just so awful. I would love to be enthusiastic about rust, since every seems to love it, but I can’t get over that hurdle. Backporting the features into C, or even just making a transpiler from C to rust that uses annotations would be great for me. But the rust community really does not seem interested in making stepping stones from other languages to rust.

      • pheggs@feddit.org
        link
        fedilink
        English
        arrow-up
        9
        ·
        1 day ago

        I learned a bit of rust and I think it’s just about getting used to it. It’s fairly subjective, and people say the same about C++. I also prefer the C syntax because I find it’s simplicity extremely elegant and prefer it to have fewer features. And I like it for it’s consistency, on linux the FHS is based up on C, and it just somewhat feels ugly to break that consistency.

        But I also acknowledge the advantages of rust.

      • banshee@lemmy.world
        link
        fedilink
        arrow-up
        4
        ·
        1 day ago

        I’ve personally become pretty fond of the syntax and incorporation of FP features. In all fairness though, I haven’t written much C or C++ for the last two decades.

        Rust incorporates some of my favorite features from FP with handy green thread ergonomics. I’m not a fan of Go, so this gives me a great option for microservices when I can avoid Node.js.

    • anton@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      2 days ago

      C++ already has much more of the required language constructs, which is why there is already an attempt to add borrow checking to C++ called circle. Until that standardizes, I wouldn’t expect it in C.