News for hackers. Stuff that matters.
Re:Moxie: Incremental Declarative UI in Rust by for_the_many on Monday December 02, 2019 @11:44AM (#21684079)
It's nice to see that the traditional desktop GUI programmers finally realize that the way the Web people do GUIs is right (React/Vue/...) and the way they did it until now (QT/GTK/WPF/...) is wrong.

Many think that the only reason people use Electron is that it's cross-platform, when that is actually a minor benefit. The big one is just how much more better and efficient React/Vue/... are at creating GUIs. I say that as someone who programmed GUIs in pretty much everything, starting with MFC.

Re:Moxie: Incremental Declarative UI in Rust by anp on Monday December 02, 2019 @11:52AM (#21684163)
> traditional desktop GUI programmers finally realize

FWIW, I'm not a desktop GUI programmer nor am I an...uh...professional GUI programmer of any kind. Not sure exactly who is doing the realizing here, but if they are, then great!?

> the way the Web people do GUIs is right

There are definitely some attractive things about web frameworks' approaches, but it's important to remember that the history of "declarative UI" traces a path back through C++ imgui devtools before React happened.

I see the transition here differently -- the web is so opinionated about the DOM and its rendering engine, the only thing you can iterate on to make yourself more productive is the frontmost application semantics. Full-pipeline UI toolkits have to manage changes across all the various phases of their implementations.

This (I think) creates an environment where the web is a great incubator for application model experimentation.

However, many projects that start on the web have a difficult time faithfully mapping to the semantics of other GUI systems (one of the driving forces behind Electron adoption IMO). This gap is one that moxie hopes to bridge -- ideally we should be able to learn from the highly productive web ecosystem while transferring those learnings further into the UI stack without the overhead and performance cliffs of typical web tools.

Re:Moxie: Incremental Declarative UI in Rust by adev_ on Tuesday December 03, 2019 @01:55AM (#21690496)
> It's nice to see that the traditional desktop GUI programmers finally realize that the way the Web people do GUIs is right (React/Vue/...) and the way they did it until now (QT/GTK/WPF/...) is wrong.

Ironically, it's quite the opposite.

It's quite funny to see React people seeing their thing as a "GUI revolution" when React's approach have existed for 10/20 years in the traditional GUI world.

- Component oriented approach: Done by Qt, GTK, WPF, OSX for more than 20 years:

- Reactive design: Qt and other have done that for 15 years.

- Stateless Immediate rendering: IMGUI and nuklear have done it for 10 years.

- Pub/Sub event dispatch: Call it signal/slot and you had it in Qt/GTK for 15 years.

- DOM specified GUI, call it XUL, XAML or Qt XML and you had it for 10 years.

One more proof that the tech world is often a continuous reinvention with a lot of hype.

Re:Moxie: Incremental Declarative UI in Rust by delfinom on Monday December 02, 2019 @12:41PM (#21684673)
>It's nice to see that the traditional desktop GUI programmers finally realize that the way the Web people do GUIs is right (React/Vue/...) and the way they did it until now (QT/GTK/WPF/...) is wrong.

What? How is WPF any different than a web based ui framework. It does differential rendering, it uses hierarchical components in XML. WPF can update the UI with state changes on the backing C# without update commands, etc.

Re:Moxie: Incremental Declarative UI in Rust by Gene_Parmesan on Monday December 02, 2019 @02:12PM (#21685718)
I agree. Doing MVVM in WPF/XAML felt like an incredibly natural transition from web frameworks for me. In fact, from a high-level standpoint it feels uncannily similar to working in Angular and TypeScript.
Re:Moxie: Incremental Declarative UI in Rust by for_the_many on Monday December 02, 2019 @12:46PM (#21684732)
When I used it, WPF only had two way binding. The recommended way to use React/Vue is with one way unidirectional binding (Redux/Vuex). It's a huge difference, and simplifies things a lot.

Maybe WPF can do this today, I don't know, haven't touched it in 10 years.

Another aspect, while WPF might check the feature list of React/Vue, using it in practice is kind of clunky.

Re:Moxie: Incremental Declarative UI in Rust by nwallin on Monday December 02, 2019 @07:02PM (#21688492)
.NET Framework 3.0 was initially released November 21st, 2006. React.js was initially released May 29th, 2013.

There were 2381 days between differentiating between various binding types in WPF (which include one way, both OneWay and OneWayToSource) and React's release. There were 2378 days between React's release and today.

So it took React longer to copy one way bindings from WPF than it took this project to "copy" React.

Too bad you didn't make this comment on Thursday.

Re:Moxie: Incremental Declarative UI in Rust by anp on Monday December 02, 2019 @07:29PM (#21688684)
If moxie brings anything new to the table, it’s only because I copied liberally and shamelessly from React and other successful and interesting projects, learning and improving on them in the process. If it doesn’t bring anything new, then it’s because I copied liberally and shamelessly from successful and interesting projects :P.

I’m flattered to be compared to long standing paradigms I’ve had in mind (and others I am learning of now) while working on this.

Re:Moxie: Incremental Declarative UI in Rust by nwallin on Monday December 02, 2019 @08:51PM (#21689204)
I'm really only commenting on the idea that wpf doesn't have one way binding. People saying dumb stuff on the internet makes me mad. Personal failing. Like that was added in 2006. That feature was coreleased with Windows Vista and IE7. Google had just bought YouTube for $1.65bn and people were incredulous about such a stupid decision on Google's part. One way binding in wpf was released to the public three months after jQuery. It's a year older than silverlight, which is significant because silverlight just took everything that wpf was and said, "what if we could make web pages this way?" Arguably without silverlight the react folks never ask, "what if silverlight wasn't completely shitty?"

I'm not really qualified to compare wpf to react or moxie.

Second, liberally copying the best parts of other things and leaving the crappy parts behind is bringing something new to the table. Don't sell yourself short.

Re:Moxie: Incremental Declarative UI in Rust by raphlinus on Monday December 02, 2019 @09:31PM (#21689397)
Can you point me to a good introduction (document, blog post, video) to the way WPF does this? I'm actually quite interested in the older systems, especially because a lot of them come from a place where massive complexity is not seen as a good thing.
Re:Moxie: Incremental Declarative UI in Rust by pjmlp on Monday December 02, 2019 @01:28PM (#21685198)
Long time ago, because .NET 4 already had multiple bindings.
Re:Moxie: Incremental Declarative UI in Rust by pjmlp on Monday December 02, 2019 @01:29PM (#21685212)
In fact WPF original team was composed by ex-IE developers, if I am not mistaken.
Re:Moxie: Incremental Declarative UI in Rust by seanalltogether on Monday December 02, 2019 @02:26PM (#21685873)
I completely disagree. I've been working react native and the whole thing feels like an inefficient abstraction designed to improve the lives of people who have to work in browsers every day.

Web pages are stateless document trees, and libraries like react were designed to overcome those inherent problems when trying to build interactive features.

Desktop/mobile applications frameworks are designed to be stateful component trees and have design patterns to help juggle interaction, data and views more effeciently.

Re:Moxie: Incremental Declarative UI in Rust by jcelerier on Monday December 02, 2019 @01:52PM (#21685476)
> It's nice to see that the traditional desktop GUI programmers finally realize that the way the Web people do GUIs is right (React/Vue/...) and the way they did it until now (QT/GTK/WPF/...) is wrong.

c'mon, Qt has been doing declarative UI for the last ten years, before React and Vue even existed : https://patrickelectric.work/qmlonline/

Re:Moxie: Incremental Declarative UI in Rust by pier25 on Monday December 02, 2019 @02:04PM (#21685635)
It may be declarative, but is it reactive?

Edit: it may not sound that way but I swear I was honestly just asking a question. :)

Re:Moxie: Incremental Declarative UI in Rust by jcelerier on Monday December 02, 2019 @02:36PM (#21685974)
yes ? in an even purer form than most JS frameworks : just using a variable creates a reactive binding.

e.g.

    property int count: 0
    Text {
      text: "counter " + count
    }
    Button {
      onClicked: count++
    }
will result in the text changing every time the button is clicked (for a complete code example you can paste in the previous link :

    import QtQuick 2.7
    import QtQuick.Controls 2.3

    Rectangle {
        id: root
        anchors.fill: parent
    
        property int count: 0
        Column {
          Text {
            text: "counter " + count
          }
          Button {
            onClicked: count++
          }
        }
    }
Re:Moxie: Incremental Declarative UI in Rust by pier25 on Monday December 02, 2019 @02:39PM (#21685996)
Thanks!
Re:Moxie: Incremental Declarative UI in Rust by rumanator on Monday December 02, 2019 @01:17PM (#21685086)
> It's nice to see that the traditional desktop GUI programmers finally realize that the way the Web people do GUIs is right and the way they did it until now (QT/GTK/WPF/...) is wrong.

Can you provide any detail to corroborate your assertion? Because the Qt way of developing GUIs is based on a combination of a DOM, events and state machines to update the state of each subtree in the DOM.

Re:Moxie: Incremental Declarative UI in Rust by raphlinus on Monday December 02, 2019 @12:54PM (#21684813)
This is actually one of the reasons I'm so excited about the space. If it is possible to combine modern, Web-inspired ways of building UI with Rust's performance and other qualities, I think the result could be compelling. But we don't know yet, and I think what's needed now is an exploration of the various ways to adapt these reactive approaches into idiomatic Rust. I've been tracking Moxie and think it brings a lot to the conversation - I think Adam and I have been learning a lot from each other.
Re:Moxie: Incremental Declarative UI in Rust by fla on Monday December 02, 2019 @12:30PM (#21684541)
I don’t think this statement is correct.For example Qt has been doing declarative with QML for years.
Re:Moxie: Incremental Declarative UI in Rust by hellofunk on Monday December 02, 2019 @01:10PM (#21685009)
I generally agree with the OP except that lumping QML into the old-school GUI techniques isn't a proper fit. Traditional Qt Widgets, yes, but QML is indeed not far from the React-style of GUI programming.
Re:Moxie: Incremental Declarative UI in Rust by rumanator on Monday December 02, 2019 @06:27PM (#21688254)
> Traditional Qt Widgets, yes

No you're still quite wrong. QWidgets-based UIs still consist of a DOM driven by a state machine that handles events. UI files have a 1:1 correspondence with components and state machines still control changes to the widget/DOM tree.

Re:Moxie: Incremental Declarative UI in Rust by hellofunk on Tuesday December 03, 2019 @04:06PM (#21696705)
But are widgets reactive in the way QML is? That’s the issue.
Re:Moxie: Incremental Declarative UI in Rust by kibwen on Monday December 02, 2019 @12:16PM (#21684398)
I'm no UI programmer, but this is such a strong claim that I would ask you to elaborate further.
Re:Moxie: Incremental Declarative UI in Rust by eitland on Monday December 02, 2019 @12:25PM (#21684488)
I tell you what was efficient for creating GUIs:

The old Visual Basic (and I've also heard Delphi.)

Doesn't mean I want them anywhere near my projects. The web is somewhat better thanks to declarative UI (for those that use it) and separation of concerns (again for those who take advantage of it).

Re:Moxie: Incremental Declarative UI in Rust by pjmlp on Monday December 02, 2019 @01:30PM (#21685232)
You can do declarative UI with Forms as well, it just takes a bit more of code than WPF to set up the data binding contexts and layouts.
Re:Moxie: Incremental Declarative UI in Rust by WAHa_06x36 on Monday December 02, 2019 @01:24PM (#21685165)
Sure, if you don't care about transitions and animations at all.

If you're wanting to do a really responsive and nice-feeling app, the react model hinders you far more than it helps.

Re:Moxie: Incremental Declarative UI in Rust by tracker1 on Monday December 02, 2019 @02:22PM (#21685834)
What you're describing is pretty much how a LOT of game UIs have been developed for YEARS before React/Vue... in fact, I was doing similar with E4X in browser half a decade before React (though without chrome or ie support, it was kind of a dead end).
Re:Moxie: Incremental Declarative UI in Rust by layoutIfNeeded on Monday December 02, 2019 @12:09PM (#21684339)
> The big one is just how much more better and efficient React/Vue/... are at creating GUIs

Efficiency is not the first thing that pops to my mind when I look at the Electron-based apps in my task manager.

Re:Moxie: Incremental Declarative UI in Rust by Tronno on Monday December 02, 2019 @12:23PM (#21684468)
They were probably referring to speed/ease of development, not application performance.
Re:Moxie: Incremental Declarative UI in Rust by Gibbon1 on Monday December 02, 2019 @02:06PM (#21685656)
> application performance

I feel like this has suffered because the end users aren't the ones paying the bills in web space.

Re:Moxie: Incremental Declarative UI in Rust by pier25 on Monday December 02, 2019 @02:02PM (#21685616)
As someone who started doing UI in the late 90s I totally agree.

AFAIK Flutter and SwiftUI are bringing those web ideas into mobile/desktop dev.

AFAIK there is still nothing similar in the C++ world.

Re:Moxie: Incremental Declarative UI in Rust by zelly on Monday December 02, 2019 @06:37PM (#21688321)
Flutter is available for C++ desktop programming. You just cannot do all the UI logic in C++; you have to use Dart.
Re:Moxie: Incremental Declarative UI in Rust by pier25 on Tuesday December 03, 2019 @12:08PM (#21694204)
> Flutter is available for C++ desktop programming

I know Flutter for desktop is in process. Any link with more info?