• solrize@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    2 months ago

    Yeah I had thought that C# was basically Microsoft’s version of Java, GC’d throughout. But it’s fine, I’m not particularly more excited by it now than I was before (i.e. unexcited). I’m not even excited by Rust, but maybe I’m missing something. I think it’s fine to use GC for most things, and program carefully in a non-allocating style when you have to, using verification tools as well.

    A classic: http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html

    • nous@programming.dev
      link
      fedilink
      English
      arrow-up
      4
      ·
      2 months ago

      There are quite a few places where a GC is just not acceptable. Anything that requires precise timing for one. This includes kernel development, a lot of embedded systems, gaming, high frequency trading and even latency critical web servers. Though you are right that a lot of places a GC is fine to have. But IMO rust adds more than just fast and safe code without a GC - lots of people come to the language for those but stay for the rest of the features it has to offer.

      IMO a big one is the enum support it has and how they can hold values. This opens up a lot of patterns that are just nice to use and one of the biggest things I miss when using other languages. Built with that are Options and Results which are amazing for representing missing values and errors (which is nicer than coding with exceptions IMO). And generally they whole type system leads you towards thinking about the state things can be in and accounting for those states which tends to make it easier to write software with fewer issues in production.

    • GetOffMyLan@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      2 months ago

      It has always had structs. They are often used for interop but can be used to avoid allocations and they are memory safe out the box, which nice.

      Both languages are really great in my opinion. But very different use cases generally.