Apologies if this question isn’t really appropriate for this community, but Rust and Kotlin are my two favorite programming languages, and currently, I use both for different projects. However, I’m curious as to if people here think Kotlin still has a place when Rust exists? I’m specifically speaking architecturally: disregarding existing legacy code or support, do you think in the future, the Rust platform should replace the Kotlin platforms (JVM, LLVM Native, Android, Web) for everything Kotlin can do, or do you think Kotlin can do some things better than Rust?

  • qaz
    link
    fedilink
    10
    edit-2
    9 months ago

    Circular references and objects shared by multiple scopes (e.g. a lambda that uses the value of an UI element) are still quite annoying to work with and require a lot of boilerplate code because it requires wrapping it with a Rc and RefCell. None of this requires any additional effort when using a GC language like Kotlin or C#.

    I have used Rust to write GTK applications but it wasn’t pretty and I ended up using GTKSharp in the end.

    • @kartonrealista@lemmy.world
      link
      fedilink
      39 months ago

      GTK has poor compatibility with Rust, due to it’s inheritance/OOP design. Iced-rs is a neat GUI library that works well with Rust’s features, you define view separately from the update loop. In the view you place widgets which send messages, and the update function listens to those and based on pattern matching the message updates the central struct when one is sent.

      You can often achieve the same result in a different way if you’re not married to certain features, or in this case frameworks.

      • qaz
        link
        fedilink
        09 months ago

        I have considered Iced but it does not integrate well with KDE Plasma, I might try it again in the future if the documentation has been improved.

    • True, but I also find that when you are dealing with circular reference and shared object scopes a bit of extra syntax and wrapping is the least of your problems.

      In this case the garbage collector handles the memory for you, but for every other complication arising from these patterns you are still on your own. Keeping track of updates, locks, non-memory resource.