News for hackers. Stuff that matters.
Re:The initial proposal for a C++ Ecosystem International St... by jcelerier on Tuesday October 18, 2022 @12:38PM (#33250144)
Rust doesn't have Qt
Re:The initial proposal for a C++ Ecosystem International St... by gavinray on Tuesday October 18, 2022 @12:42PM (#33250207)
Re:The initial proposal for a C++ Ecosystem International St... by rvz on Tuesday October 18, 2022 @01:20PM (#33250825)
Not only those are rudimentary unofficial bindings but that looks unmaintained and is already out of date. Last updated 2021.

So no. Rust does not have official Qt support.

Re:The initial proposal for a C++ Ecosystem International St... by juunpp on Tuesday October 18, 2022 @04:02PM (#33253052)
It's surprising to me that this was downvoted. Many a Rust project pulls several hundred Cargo dependencies that the developer probably hasn't even checked against basic things like outstanding bugs. The lack of standard package management in C++ sometimes is for the best.
Re:The initial proposal for a C++ Ecosystem International St... by jcelerier on Tuesday October 18, 2022 @03:19PM (#33252511)
> https://github.com/rust-qt/examples/blob/master/widgets/basi...

this is ridiculous. rust does not have overloading ?

Re:The initial proposal for a C++ Ecosystem International St... by josephg on Tuesday October 18, 2022 @03:36PM (#33252711)
Nope! Rust doesn’t have function overloading like C++.

It does have operator overloading - but that’s not the same thing at all.

Re:The initial proposal for a C++ Ecosystem International St... by jcelerier on Wednesday October 19, 2022 @12:22PM (#33264447)
here's the code translated to C++: https://gist.github.com/jcelerier/f76e3ee55037675db559e5062f...

Rust certainly brings a lot, but I would really doubt of the sanity of anyone who would take the rust code over the C++ one here

Re:The initial proposal for a C++ Ecosystem International St... by tialaramex on Tuesday October 18, 2022 @06:31PM (#33254957)
Rust doesn't have any sort of ad hoc polymorphism. Of course, you would usually have a sensible name for these functions (maybe new_0a is a sensible name, I'm not a Qt programmer but I rather doubt it).

Rust's "constructors" aren't magic, whereas the C++ constructors are magic, so they need ad hoc polymorphism or you could only have one constructor for each type.

Let's compare familiar types which weren't built using some sort of FFI magic, C++ std::vector and Rust's alloc::vec::Vec.

std::vector has 10 constructors, they can't have different names, so they're distinguished by their parameters, perhaps your IDE will prompt you with a list of options or you'll remember the parameters you need to do what you intended.

Vec::new() makes a Vec, Vec::new_in(allocator) makes a Vec using a specific allocator, Vec::with_capacity(4) makes a Vec with capacity for 4 things and so on.

Somebody else mentioned operators, note that Rust doesn't really overload operators either. In Rust the operators are getting implemented. If you don't implement an operator, then it doesn't exist, whereas in C++ the operators often have some pre-defined behaviour and you can change that using overloading.

For example if your type Doodad should like to be able to use the + operator on other Doodads, you can implement core::ops::Add<Doodad> for Doodad - now the + operator works when both sides are Doodads. If you'd like a += b; to work, you'd implement core::ops::AddAssign<Doodad> for Doodad. These traits require methods with the appropriate signature e.g. AddAssign::add_assign(&mut self, rhs: Doodad) saying this function needs a mutable reference to a but consumes b.

Re:The initial proposal for a C++ Ecosystem International St... by account42 on Wednesday October 19, 2022 @06:51AM (#33260218)
> std::vector has 10 constructors, they can't have different names

Except you can have static member functions (calling private constructors) if you do want that. Of course that doesn't compose as well as overloaded constructors which e.g. lets all constructors for a type T be accessed via std::vector<T>::emplace_back().

Re:The initial proposal for a C++ Ecosystem International St... by steveklabnik on Tuesday October 18, 2022 @05:00PM (#33253883)
It's not exactly Qt, but some former Qt folks are making https://slint-ui.com/
Re:The initial proposal for a C++ Ecosystem International St... by jcelerier on Tuesday October 18, 2022 @09:30PM (#33256320)
and knowing three of them IRL I really trust them to make something amazing - they already do especially with the work on microcontrollers and it will likely be my first choice if I have to show an UI from an uc - but API-wise Slint is quite similar to QML with a declarative tree approach ; having worked now on maybe 3 dozens of distinct projects using either QML or Qt Widgets (traditional widget tree retained API), ranging from one-shot software used at 1 event written in an afternoon, to car dashboards, to traditional WIMP author software, to freakin Unity3D plug-ins, I still find the widget API better for many, many cases (mainly in the technical and CRUD UIs which I mostly use my computers for).

But when I say "Rust does not have Qt" this is actually not what I refer to.

A big point of Qt is that you have a complete consistent library with an event loop that will handle everything from GUI to network / serial port communication / media playback / JS scripting / database access / ... transparently, with APIs that are fairly cohesive. With Rust whenever I looked at it it was async API flamewar and the need to use 50 libraries that all have slightly different conventions, namings, etc. Qt brings consistency, just like boost does, and that's why I like using those ; most of the time I don't even have to think about what the name of something is going to be in a class / type I've never used, because it's obvious from the naming scheme of the library.

Re:The initial proposal for a C++ Ecosystem International St... by tialaramex on Wednesday October 19, 2022 @05:56AM (#33259812)
> A big point of Qt is that you have a complete consistent library with an event loop that will handle everything from GUI to network / serial port communication / media playback / JS scripting / database access / ... transparently

A kitchen sink library, re-implementing absolutely everything. I do mean everything there's even a QString to use because heaven forfend a C++ library wouldn't have its own custom String class...

The temptation to build kitchen sink libraries is exactly what this proposal seems to be fighting. No, I don't expect they will win.

Re:The initial proposal for a C++ Ecosystem International St... by pjmlp on Wednesday October 19, 2022 @05:59AM (#33259841)
Kitchen sink libraries usually work in all supported platforms, no need to play tetris with OS and compiler version support.
Re:The initial proposal for a C++ Ecosystem International St... by cyber_kinetist on Wednesday October 19, 2022 @07:48AM (#33260732)
I think the reason QString was necessary was because STL's std::string was just really lackluster (and still is). The problems:

- An barebones API that's hard to use (missing really basic functions like contains() and split(), although they might come on C++2-god-knows-fuck-when)

- Until recently (C++20), didn't have a convenient way to format strings. QString::args() isn't that nice, but at least it's far better than using the stream operators. It's just sad that people were hyped that std::format was finally coming in the year two-thousand-fucking-twenty...

- Dealing with encodings and locales. Unicode conversions, anyone? Like, C++17 actually even deprecated the whole <codecvt> header! I understand it was absolute shit, but the audacity to remove it without presenting an alternative...

Re:The initial proposal for a C++ Ecosystem International St... by jcelerier on Wednesday October 19, 2022 @11:22AM (#33263546)
> A kitchen sink library, re-implementing absolutely everything

yes, and having written projects in both the kitchen sink and the many-libraries approaches, the one that consistently shipped software fast is the one with the kitchen sink framework

Re:The initial proposal for a C++ Ecosystem International St... by cyber_kinetist on Wednesday October 19, 2022 @07:58AM (#33260845)
I really hope their project succeeds, even outside of it being written in Rust. There is a very real and urgent need for a framework for complex cross-platform desktop GUIs, and Qt (which was really the only good solution for it) is currently sinking under its weight.
Re:The initial proposal for a C++ Ecosystem International St... by dureuill on Wednesday October 19, 2022 @07:37AM (#33260644)
This is the only correct answer.

Although give it 10 years and that issue should be resolved.