News for hackers. Stuff that matters.
Re:Technical Vision for Qt 6 by ungzd on Wednesday August 07, 2019 @11:43AM (#20635748)
C++ (and even Rust) is not the best language to build UIs. Even if your app heavily uses C/C++ to do heavy computations, "scripting" language will be preferable for "glue code". QML is not a crazy new idea, for example Tk used Tcl.

And due to C++ API, Qt has poor language bindings, compared to GTK and many others with C API.

Re:Technical Vision for Qt 6 by blub on Wednesday August 07, 2019 @12:31PM (#20636261)
I believe you're incorrect, C++ is a good language for building UIs, as proven by the plethora of UI libraries and frameworks built in C++ for pretty much all platforms. This is visible when comparing PyQt and C++: yes, PyQt is easier to get into, has nicer syntax, but C++ offers more power. Even hot-loading UIs, a typical scripting language advantage is supported.

Declarative UI languages do have some advantages compared to regular programming languages, but that's unrelated to the claim you made.

Bindings are not C++'s problem, they're the problem of the other languages which try to use UI frameworks written in C++, like Rust, which still doesn't have any decent UI library.

Re:Technical Vision for Qt 6 by jlarocco on Wednesday August 07, 2019 @12:46PM (#20636408)
> This is visible when comparing PyQt and C++: yes, PyQt is easier to get into, has nicer syntax, but C++ offers more power.

That may be true for Python, but the Common Lisp bindings for Qt4 were equally as "powerful" as the C++ bindings. It had higher level abstractions that generally made it easier to read and write, as well.

> Bindings are not C++'s problem

Actually, bindings are a problem with C++. Some features (like templates) and implementation details (like name mangling) make it very difficult to create bindings to C++.

Re:Technical Vision for Qt 6 by pjmlp on Wednesday August 07, 2019 @01:13PM (#20636720)
They have the graphics layer written in C++, but get used from managed languages.

QML, Swift, Android, UWP, WPF, Forms, Blueprints, Unity, React Native.

Re:Technical Vision for Qt 6 by jschwartzi on Wednesday August 07, 2019 @04:07PM (#20638372)
I've worked on two products with touchscreen UIs now and I can safely say this is exactly how I want to do things. Have a tight core engine but with a flexible declarative language that I can get imperative with. And make it easy for me to declare connections between the model and the view without specifying data types. And give me a way to work with a statically typed language when that's beneficial.

QML is way faster to develop in than C++. And it hides a lot of signal/slot boilerplate that doesn't matter. And I can still write C++ classes that interface with QML when I want.

Re:Technical Vision for Qt 6 by flukus on Thursday August 08, 2019 @12:59AM (#20641978)
> I believe you're incorrect, C++ is a good language for building UIs

I agree, not necessarily with c++ but it's much better to build UI's with code than declarative xml crap.

It will be a shame if Qt sticks to a pure c++ interface though, I'd hope the build something more usable from more languages so it's an option for C, Zig, Rust, etc.

Re:Technical Vision for Qt 6 by protomyth on Wednesday August 07, 2019 @12:51PM (#20636466)
I keep coming back to the differences between OPENSTEP and Taligent and believe C++ isn't the best choice.
Re:Technical Vision for Qt 6 by ptx on Wednesday August 07, 2019 @01:47PM (#20637026)
What were some of the differences? (Other than Taligent dying and OPENSTEP surviving via Mac OS X, which is all I know about the topic.)
Re:Technical Vision for Qt 6 by protomyth on Thursday August 08, 2019 @02:36PM (#20647271)
Re:Technical Vision for Qt 6 by infinite8s on Wednesday August 07, 2019 @10:05PM (#20641170)
There's a reason Qt had to invent the MOC.
Re:Technical Vision for Qt 6 by qekbg on Wednesday August 07, 2019 @11:54AM (#20635856)
>C++ (and even Rust) is not the best language to build UIs.

Why? And why are scripting languages better?

Re:Technical Vision for Qt 6 by ygra on Wednesday August 07, 2019 @12:02PM (#20635925)
Developer productivity when building or redesigning a UI is often far more important than raw performance. There's usually no noticeable difference for a user whether the dialog they opened via a button click is built in highly optimized C++ or from an XML resource stream that is read, parsed, and the UI constructed on the fly by effectively interpreting the UI description.

It's okay to have expensive abstractions where a few milliseconds simply don't matter, but tasks can be done in minutes instead of hours. Declarative UI descriptions also have the benefit of being friendly to visual designer applications, so you need fewer build/run/test cycles (which are far from quick with C++).

Re:Technical Vision for Qt 6 by qekbg on Wednesday August 07, 2019 @12:28PM (#20636238)
>There's usually no noticeable difference for a user whether the dialog they opened via a button click is built in highly optimized C++ or from an XML resource stream that is read, parsed, and the UI constructed on the fly by effectively interpreting the UI description.

I dare you to compare the speed of UIs of Windows XP and Windows 10, even when using the hardware that was current when those OSes were released.

Re:Technical Vision for Qt 6 by hedora on Wednesday August 07, 2019 @01:02PM (#20636590)
Someone did a detailed study of UI responsiveness vs year.

Responsiveness peaked in the 80’s, in the dumb terminal + regional mainframe era. :-(

Re:Technical Vision for Qt 6 by badsectoracula on Wednesday August 07, 2019 @02:45PM (#20637623)
Do you have a link? If it is the one i remember it was about keyboard-to-output responsiveness (and the winner was something like a C64 or Apple 2 or something like that), not overall UI (and i'm a bit skeptical about the dumb terminal part considering the communication latencies involved, especially in the 80s).
Re:Technical Vision for Qt 6 by blub on Wednesday August 07, 2019 @12:37PM (#20636332)
This "productivity is more important than raw performance" meme again... Your first paragraph claims the opposite of what's happening reality: there is a noticeable difference between clicking that highly optimized C++ button and going through XML, as seen in Mozilla's XUL or typical web apps.

I can't even imagine why you'd think that reading and parsing XML and constructing a UI would be cheaper than any other way of building UIs.

Re:Technical Vision for Qt 6 by coldtea on Wednesday August 07, 2019 @01:26PM (#20636851)
>there is a noticeable difference between clicking that highly optimized C++ button and going through XML, as seen in Mozilla's XUL or typical web apps.

Really, did you measure it? Since we are, scientists and everything? Where are the numbers?

And how do any differences you've found compare (timing wise) with human initiated action and perception latencies -- like those required to click an on-screen button and see it being depressed?

>as seen in Mozilla's XUL or typical web apps

You see button being pressed time/action as a problem in "XUL or typical web apps"?

(Memory consumption when the drawing is done with DOM, or slow rendering of large scene graphs, I'd buy -- but this is not the model we're talking here, where JS calls a native control directly, and doesn't render through DOM/web rendering).

>I can't even imagine why you'd think that reading and parsing XML and constructing a UI would be cheaper than any other way of building UIs.

Actually that's the way tons of native apps work, from games, to Gnome, to Windows and so on.

Second, if you think the "parsing a XML UI declaration" is in any meaningful way more expensive that imperatively calling a bunch of UI functions directly, you have a distorted idea of what makes a UI slow, or of the time needed to parse an XML file and initialized controls based on it...

Re:Technical Vision for Qt 6 by rat9988 on Wednesday August 07, 2019 @02:05PM (#20637235)
>Really, did you measure it? Since we are, scientists and everything? Where are the numbers?

This remark should (also) have been directed at his parent comment, who made the contrary claim without any measurement either.

> Second, if you think the "parsing a XML UI declaration" is in any meaningful way more expensive that imperatively calling a bunch of UI functions directly, you have a distorted idea of what makes a UI slow, or of the time needed to parse an XML file and initialized controls based on it...

The numbers?

Re:Technical Vision for Qt 6 by blub on Wednesday August 07, 2019 @02:34PM (#20637504)
I'm not a scientist, so I did not measure it, however my empirical analysis suggests that this is indeed the case. Non-native UIs are noticeably slow. They don't have a monopoly on being slow, but they are slow across the board.

You might want to read this ode to fast software: https://craigmod.com/essays/fast_software.

Re:Technical Vision for Qt 6 by slavik81 on Wednesday August 07, 2019 @01:38PM (#20636953)
I don't understand why they would parse the XML on the fly. Qt's designer spits out *.ui XML files that are compiled by Qt's uic into the same plain old C++ you would write to create and arrange the widgets.

Lots of C++ Qt apps create their UIs from XML. They just do it at compile time.

Re:Technical Vision for Qt 6 by jcelerier on Thursday August 08, 2019 @02:31AM (#20642328)
.ui files can also be parsed at run-time (with QtUiTools iirc)
Re:Technical Vision for Qt 6 by codr7 on Wednesday August 07, 2019 @12:08PM (#20635985)
The user interface tends to be a relatively dynamic part of the application.

Most of this is no longer as relevant in C++, can't speak for Rust. Programming languages have been converging for quite some time, C++ of today is more dynamic and convenient than any version that came before.

That being said, you can't beat dynamic languages for some tasks. Runtime code generation/eval being the most obvious I can think of. Any kind of extension/plugin architecture has everything to win from going all in with a full scripting language from my experience.

Re:Technical Vision for Qt 6 by oblio on Wednesday August 07, 2019 @12:04PM (#20635947)
Memory management.