From a language architecture standpoint and not an ecosystem standpoint, what might be some things where you’d really not want to use Rust, either because of some limitation that prevents it from doing it or just because it’d be massively annoying to write to the point of significantly reduced productivity? What about Rust makes it unsuitable, and what language paradigms are the best for it?

I hear a lot about how the things that Rust is not good for, JIT compilation with a garbage collector is usually the best solution, and vice versa. How true is this?

  • DessalinesA
    link
    fedilink
    arrow-up
    7
    ·
    3 years ago

    On the garbage collector point: I used to do java professionally, and it made me never want to use any garbage collected language ever again.

    I have some nightmare stories… one giant monolithic program was so bad on memory, that after running for a few days, it would take up all the memory of a 24 GB machine, and one of our devs had to manually write a ton of code to garbage collect certain things just to keep the thing alive.

    Even small programs in GC languages have that problem: they can never really be smart enough to know which data can be scrapped, and do the safest thing, which is to keep it all in memory. Even a simple java program I wrote a few years ago grows to fill up the memory of the 1gb box I have it on, after it runs for a few weeks.

    Rust doesn’t have that problem, as it forces you to think about borrowing, stack and heap from the very beginning. When you realize its not that much more work to do so, you can see why go and java will never beat rust on memory performance.

    • pinknoise
      link
      fedilink
      arrow-up
      5
      ·
      3 years ago

      Rust doesn’t have that problem

      That’s a bit generalized you can leak memory in rust e.g. by keeping around old Weak pointers, also std::collections::* don’t shrink by themselves.