Assume mainstream adoption as used by around 7% of all github projects

Personally, I’d like to see Nim get that growth.

  • @[email protected]
    link
    fedilink
    98 months ago

    Rust doesn’t guarantee the lack of memory leaks anymore then java/C++ does, so sadly not sure if it would help here. :)

    • @hairyballs
      link
      28 months ago

      We can go further, I think it’s impossible to prevent memory leaks in a general purpose language

      • @philm
        link
        28 months ago

        Not without a super fancy type system that has to be still found. I think the key issue is cyclic data-structures (e.g. doubly-linked list). The language somehow needs to have strong/weak pointers and automatically determining them is a very complex research question…

        • @hairyballs
          link
          98 months ago

          And here you’re only talking about a subset of memory leaks, by inaccessible memory. You can also leak memory by pushing new elements in a channel while never reading them for example.

        • @zygo_histo_morpheus
          link
          18 months ago

          You are absolutely correct that rusts safety features don’t extend to memory leaks, but it’s still better than most garbage collected languages unless you abuse Rc or something, and it does give you quite fine-grained controll over lifetimes, copying and allocations on the heap which in practice means that rust is fairly good about memory leakages compared to most languages.

          • @[email protected]
            link
            fedilink
            9
            edit-2
            8 months ago

            How would rust fare any better then a tracing GC? Realistically I’d expect them to use more memory, and also have worse determinism in memory management - but I fail to really see a case where rust would prevent memory leaks and GC languages wouldn’t.

            • @zygo_histo_morpheus
              link
              18 months ago

              If you just Rc everything (which I’d count as “abusing Rc”) Rust is significantly worse than a language with a good GC. The good thing about Rust is that it forces you to aknowledge and consider the lifetimes of objects. By default things are allocated on the stack, but if you make something global or dynamically handled (e.g. through Rc) you have to do so explicitly. In Rust the compiler has greater compile time information about when things can be freed which means that you need less runtime overhead to check things and if you want to minimize the amount of potentially long-lived objects you can more easily see how long objects might live by reading the code as well as get help by the compiler to determine if a lifetime-based refactoring is sound or not.

            • @zygo_histo_morpheus
              link
              18 months ago

              I think you know what I mean when I contrast Rust with GC’d languages, we can call it opt-in garbage collection if we’re being pedantic.