News for hackers. Stuff that matters.
Re:Rust Qt Binding Generator by StevePerkins on Friday May 18, 2018 @06:33AM (#17100287)
I've seen a ton of bindings like this over the years, mostly implemented with SWIG (http://www.swig.org/)... for binding desktop GUI libraries like Qt, wxWidgets, etc to languages more accessible than C++.

It's all awesome, and this example here is certainly better than most (fantastic work!). The problem has traditionally been that most of these things are hobby projects from a single developer, and they go moribund when the developer gets bored and moves onto something else. Hell, if you Google around a bit, you might still find a "wxJava" binding on Sourceforge that I started and abandoned ~15 years ago.

To actually be fit for production use, one of these things needs to be either: (a) sponsored by some entity that keeps leadership continuity going, or (b) driven by an unusually large and unusually non-toxic volunteer group that is able to effectively mimic "a", or (c) created by someone who sees it as their crowning achievement and effectively dedicates their life to it. If this project really does have committed backing from the full KDE organization itself, then that's very encouraging!

I'd be interested to know if it's really an organization level commitment, or if they're just providing hosting for an experiment spearheaded by a single contributor (the Go team at Google has an "experimental" GUI library like this, but it's just one guy's noodling and no one really sees it as gaining traction outside of that). I'd also be curious what the cross-platform story is at this point (i.e. does it build and run on Windows?).

The only other examples I've seen so far that even come close to fitting the bill are in the Python community. And even that is a bit of a mess. There's confusion between two competing Qt bindings... and the wxWidgets binding has been going through a re-write for years, such that it's confusing whether to stay on the old version or adapt the new one (kinda like Python itself!).

But I still keep my eyes open, and look into this space every year or so. It would just be so awesome if there were a viable cross-platform desktop GUI solution, for a modern statically typed language somewhere between the extremes of C++ and JavaScript. I accept that desktop development is less important than it was 15 years ago... but I reject this notion that, "Desktop development is dead, just use Electron". There are still millions of use cases for true desktop applications. The only thing that's "dead" is the notion of being able to get away with just writing a native Windows version, and ignoring Macs (or vice-versa). And all of the cross-platform solutions have major problems, or are tied to languages or toolchains that people don't want to use, so that lack kinda sucks the oxygen out of the room for the open-source and hobbyist crowd on web forums.

Re:Rust Qt Binding Generator by jcelerier on Friday May 18, 2018 @08:19AM (#17100797)
> The problem has traditionally been that most of these things are hobby projects from a single developer, and they go moribund when the developer gets bored and moves onto something else.

I don't know for other libs, but Qt has strong API stability guarantees, so you need to generate the bindings only once per major Qt version - that is, once every five or six years. Just because the binding hasn't been commited to for a few years doesn't mean that it won't work.

> It would just be so awesome if there were a viable cross-platform desktop GUI solution, for a modern statically typed language somewhere between the extremes of C++

What's wrong, with, as you mentioned, C++ and Qt ? It can be as high-level as you want it to. I've been successfully developing a large desktop app with it and it has been a pleasure from start to end.

Re:Rust Qt Binding Generator by pjmlp on Friday May 18, 2018 @07:48AM (#17100642)
> It would just be so awesome if there were a viable cross-platform desktop GUI solution, for a modern statically typed language somewhere between the extremes of C++ and JavaScript.

For me that is JavaFX and Xamarin.Forms.

> The only thing that's "dead" is the notion of being able to get away with just writing a native Windows version, and ignoring Macs (or vice-versa)

Depending on the world region, you can still get away with targeting only Windows.

Not every country has lots of people able to pay for Apple devices, or even with Apple stores in every corner.

Re:Rust Qt Binding Generator by j1elo on Friday May 18, 2018 @06:41AM (#17100323)
You are right, it would be great to see bindings as promising as these ones, but backed by some big players in the Qt world (such as e.g. KDAB which already provide very useful and well supported tools like the awesome GammaRay)
Re:Rust Qt Binding Generator by dvfjsdhgfv on Friday May 18, 2018 @07:47AM (#17100633)
I completely agree with your thoughts. However, Rust is getting a lot of traction these days. Sooner or later more people will start to wonder "How do I write a portable app in it?" The Qt solution is a neat one, and might soon become the de facto standard - something similar happened with Python and Tk in the past.
Re:Rust Qt Binding Generator by danieldk on Friday May 18, 2018 @11:42AM (#17102348)
I have dabbled a bit in Rust GUI programming for a small project and gtk-rs also works quite well. Is is also actively maintained and has regular releases.

http://gtk-rs.org/

Some people from the GNOME and Rust communities are working on macro magic that allows you to create GObject classes from Rust [1].

The downside is that the applications do not look native on macOS or Windows. But so doesn't Electron ;).

[1] https://gitlab.gnome.org/federico/gnome-class/

Re:Rust Qt Binding Generator by foldr on Friday May 18, 2018 @12:41PM (#17102842)
Historically, only languages with enormous amounts of traction have developed mature, consistently maintained GUI libraries. Right now, it's basically only C++, Python and Java that have any.
Re:Rust Qt Binding Generator by snarfy on Friday May 18, 2018 @08:20AM (#17100802)
I have hope WebAssembly can make it happen. If you compile Qt and target WebAssembly, and compile Rust and target WebAssembly, it should all be able to work together automatically without needing tools like SWIG.
Re:Rust Qt Binding Generator by slavik81 on Friday May 18, 2018 @05:09PM (#17104968)
You can already compile Rust to x86 and Qt to x86, yet they don't work together automatically. Is there any reason to expect WebAssembly will be different?
Re:Rust Qt Binding Generator by snarfy on Saturday May 19, 2018 @01:13AM (#17106752)
I'm unfamiliar with WebAssembly, but I thought the spec was a little higher level. Two x86 apps might have the same op codes, but they don't always have the same calling conventions. How do you call a C function? You can't tell looking at the binary output, you only get the symbol name. Is it cdecl, stdcall, how many parameters and the names and types? Kotlin and Java work together, so do C# and F#.
Re:Rust Qt Binding Generator by moosingin3space on Friday May 18, 2018 @11:02AM (#17102011)
ABI would still be a complication here, as different languages have different ways of calling into each other, different name mangling rules, etc.
Re:Rust Qt Binding Generator by loup-vaillant on Friday May 18, 2018 @09:12AM (#17101137)
> he only thing that's "dead" is the notion of being able to get away with just writing a native Windows version, and ignoring Macs (or vice-versa).

Linux and BSD however can safely be ignored. (Writing this from an Ubuntu laptop.)

Re:Rust Qt Binding Generator by sevensor on Friday May 18, 2018 @09:40AM (#17101331)
If you're writing Qt, getting it to work on Linux if it already works on Windows probably isn't terrible. It certainly hasn't been for the PyQt GUI program I work on. Making a working Qt/X11 program work on Windows, on the other hand -- that could be painful.
Re:Rust Qt Binding Generator by danieldk on Friday May 18, 2018 @11:52AM (#17102424)
Making a working Qt/X11 program work on Windows, on the other hand -- that could be painful.

I maintain a Qt application for Linux/macOS/Windows, with in total ~70kloc the last time I looked. It started as a Linux application, but porting to Windows was not a lot of effort and the amount of platform specific code is very small. The painful part on Windows are some non-Qt dependencies, such as libxml2, libxslt, DB XML, etc.

The port to macOS required much more platform-specific code to implement macOS-specific behavior (such as keeping the application running when the last window closes), building working, signed application bundles, etc.

Re:Rust Qt Binding Generator by loup-vaillant on Friday May 18, 2018 @01:31PM (#17103270)
(I was being sarcastic, by the way. That Linux isn't even mentioned in a sub-thread that talks about portability is disappointing.)
Re:Rust Qt Binding Generator by StevePerkins on Friday May 18, 2018 @02:09PM (#17103608)
Must everything be so carefully screened for triggers? The GitHub project behind this overall thread mentions ONLY support for Linux/Docker, for crying out loud.
Re:Rust Qt Binding Generator by loup-vaillant on Saturday May 19, 2018 @03:37AM (#17107021)
Well… it at least indicates that most people here don't use a free OS (even if we exclude Windows), and don't care much about free software. (Permissive licences however are loved, mostly because they allow proprietary derivative works.)

We used to talk about Windows/Linux for portability topics (conveniently ignoring BSD and others, I reckon). Somehow, Apple took over much of Linux's mindshare. And not just here. Many of my coworkers are asking for apple laptops. A huge fraction of keynote presenters use an apple laptop.

All that is a bit sad, considering Apple is even worse than Microsoft, freedom wise. They popularised the digital prison, that was originally confined mostly to game consoles. I'll never forgive that, no matter how much they contribute to open source.

Re:Rust Qt Binding Generator by oever on Saturday May 19, 2018 @07:16AM (#17107389)
I for one think software freedom is very important.