this post was submitted on 19 Jan 2021
11 points (78.9% liked)
Rust Programming
8189 readers
5 users here now
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I'm more experienced with java, but have used kotlin a bit too. The JVM languages are extremely versatile and capable of doing anything, but kotlin is probably the best of them in terms of syntax.
That said, after dealing with java's garbage collector, I don't think garbage-collected languages have a place in the future. Rust showed me that despite claims of garbage collected languages being easier, simple scoping and borrowing don't really add any complication, and are better in terms of memory in the long run, and a better choice for pretty much every type of application.
But practically of course browsers aren't going anywhere (so we'll still need to learn javascript / typescript), and neither is android (so we'll still need to learn a jvm language). I'll still use kotlin, but only for android. Rust already has functioning web servers, UI toolkits, CLI toolkits, and everything you need for desktop or server apps.
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.
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.
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.
I would at least disagree on the browser side, look at dioxus-liveview. There is no need for js anymore 😉
You can say this about any mainstream language. So it does not really mean much on its own. Technically speaking all mainstream languages are equally powerful (them all being Turing complete), so the only real question is how easy/hard they make particular things that you might want to do and things you should avoid doing. Personally I do find rust strikes this balance best over all the languages I have tried.