• 402 Posts
  • 2.32K Comments
Joined 3 years ago
cake
Cake day: April 27th, 2023

help-circle
  • Keep in mind that software engineering as a field is like, incredibly new, compared to a lot of other fields. Computers have not been around for that long, historically speaking.

    It’s honestly to be expected that some of the first established languages did not turn out to be the best language that could be. We’re still figuring out how programming languages should be.

    In 50 years, there will probably be another series of programming languages. They might even be optimised for LLM usage rather than for human directly, who knows. This stuff is all so new.




  • Saying that “memory safety is checked by tests” is basically saying “memory safety is not checked”. Yes, you can write tests. How do you know the tests cover all cases? How do you know the tests aren’t buggy?

    Also, what about memory safety across threads? Are you testing multi-threaded scenarios? Are you ensuring you have no data races?

    I also don’t understand how this is an argument for Zig over C. You can also test memory safety of your C code via various means, but it’s never a guarantee. Zig is the same. So again, it seems a bit more pointless to go from C to Zig. Going from C to Rust brings actual tangible guarantees of memory safety (outside of any unsafe usage, obviously).


  • rust does a great job, however there are some inconsistentcies where a lot of memory allocations can throw out of memory errors that will crash the app

    That is not an “inconsistency”. Crashing the application when you run out of memory is honestly in almost all cases the correct call and crashing is memory safe. Most applications can do absolutely nothing when running out of memory. “Handling” OOM is extremely complicated and most applications simply cannot handle it in any way.

    Of course low level stuff needs to sometimes actually handle this, but it’s mostly an operating system thing. And Rust still allows you that control, it’s just not the default behavior of the collections and such in the standard library, because again, it almost never makes sense to try to handle OOM. But if you really need that behavior, you can have it.













  • Rust-based JS engine that isn’t just AI generated unsafe everywhere

    Tbf only 4% of the code was unsafe after the rewrite, which is much better than the 100% of the Zig code being unsafe. Honestly it’s not surprising you’d have such a large amount of unsafe when you translate Zig to Rust. But as I understand it, it’s since been refactored to much less than 4%.


  • SorteKanin@feddit.dkOPtoRust@programming.devRewriting Bun in Rust
    link
    fedilink
    arrow-up
    11
    arrow-down
    1
    ·
    10 days ago

    I mean it was 600,000 lines of Zig prior to the rewrite yea? If we say that a team is ~6 people, that’s 100,000 lines each to read through and translate. Assuming 250 working days in a year, that’s 400 lines of code you just need to read every day, let alone the Rust you need to be writing (approximately another 400 lines).

    Add to that overhead for planning and coordination… I actually think a year for a team might be an underestimate.