News for hackers. Stuff that matters.
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().