by pjmlp · 6y ago · 0 comments
Honestly I cannot see how to achieve something like Swift UI or Jetpack Composer, without littering Rust code with explicit reference counting.
I am also considering having visual editor in real time, and the ability to have a widget ecosystem that one just drops into the tool palette and can bind its connections in any way, possibly not considered by the widget author.
I am also looking forward to how Microsoft will eventually sort out Rust/WinRT, which has an easier job, given that COM is by definition RC based, but there is the whole usability story when putting it face to face with what .NET and C++/CX offer out of the box (C++/WinRT after 4 years in development is still catching up with VS tooling for C++/CX from 2012).
SwiftUI and Jetpack Compose are completely different beasts, though they might look similar from the outside. SwiftUI relies heavily on observable objects and basically a shared-mutable-state architecture. I believe that adapting it into Rust would be a nightmare.
Jetpack Compose, on the other hand, lets the app logic build the UI with method calls that resemble immediate mode GUI (though there are of course important differences, as it is building a retained widget tree). These updates are mediated through a mutable context object ("Composer" in the Jetpack Compose world), which adapts quite nicely into the Rust world. In particular, it does not depend on shared mutable references.
I strongly believe that it is possible to express UI in Rust quite naturally and expressively. I've written a fair amount about this recently and have provided evidence in the form of the existing Druid work and the Crochet research prototype, which represents an evolution of its reactive architecture to better support dynamic reconfiguration (a current weak spot in Druid). Of course, we won't know for sure til we get there, but in the meantime it would be nice if the naysayers at least made informed criticism.
These things trade away some runtime efficiency for developer productivity. And for many applications, that's the right trade. That's not really what Rust is about, though. I think .NET will remain a better choice for that kind of application. I just hope .NET gets a good full-AOT solution (including whole-program optimization) for desktop apps, so users don't have to pay excessively for that tradeoff.