I was really looking forward to this feature, as it would've helped improve Rust <-> C++ interoperability.
1,178 karma · joined June 30, 2012
I was really looking forward to this feature, as it would've helped improve Rust <-> C++ interoperability.
C++ is still high on the TIOBE index mainly because it is indeed old and used in a lot of legacy systems. For new projects, though, there's less reason to choose C++.
This topic comes up often, so I wrote a blog post explaining why I think a DSL is a good fit: https://slint.dev/blog/domain-specific-language-vs-imperativ...
I actually wrote a blog post about this exact topic, since it's a common question: https://slint.dev/blog/domain-specific-language-vs-imperativ...
(Disclaimer: I'm one of the Slint developers.)
Nonsense! Where do you get that from?
Aslo, you can make easily make linked list, it's just not a recommended data structure.
Doubly linked lists aren’t that important today. Rust doesn’t need gccrs to be useful, and it gives much better memory safety than C++ without needing a GC. So I find your criticism of Rust seems a bit weak. Rust is a strong alternative to C++.
- https://woboq.com/blog/reflection-in-cpp-and-qt-moc.html 2014, That was based on a previous reflection proposal
- https://github.com/woboq/verdigris : 2016, Replaces the moc by a set of macros.
What my verdigris experience shows is that it is perfectly possible to replace the moc at the cost of slightly uglier macros. And this was using C++14. I haven't look in details at the C++26 reflection, but I'm sure it would make it easier to make these macro more pretty.
Every time the users do some change in the code, the editor sends the document and we re-render the preview.
I use the textDocument/documentHighlight request to know when elements are being selected from the code so I can highlight them in the preview.
When selecting an element in the preview UI, my LSP server sends a window/showDocument to position the cursor at the right location. And if the user changes property or do change in the file, we do a workspace/applyEdit command with the changes.
Btw, the code is there: https://github.com/slint-ui/slint/tree/master/tools/lsp
Honestly, it’s a bit sad that for some, using libraries for free isn't enough, they also expect to do so without even mentioning the project.
Trying to bring that with Slint: https://slint.rs
What would you say is missing in Slint?
> probably not much harder than wrapping Qt, to be honest
There are already Qt bindings for rust (cxx-qt, qmetaobject-rs). What's missing from these?
Slint is under three licenses: GPL, or royalty-free on desktop/mobile, or paid for embedded. So you only have to pay if you sell hardware.
Slint was created with the same idea as what drives "Qt Bridges". We made a UI toolkit that is language-agnostic from the start. Slint uses its own UI language (inspired by QML), and gives you first-class, idiomatic APIs in Rust, C++, Pyhton, and JavaScript. And a clean separation between UI and business logic.
In Rust, you can call async functions from normal ones by spawning them on the executor. The .await syntax isn't as painful as dealing with callbacks and closures in JavaScript. Plus, if you call an async function incorrectly, Rust's compiler will catch it and give you a clear error message, unlike JavaScript, where bad function calls could lead to unpredictable behavior. The premises of the article don't apply, so Rust's async/await doesn't introduce the same "colored function" issues.
(See also https://without.boats/blog/let-futures-be-futures/ )
The code was already broken. It was an undefined behavior.
That's a problem with C and it's undefined behavior minefields.
This has been working since Rust 1.0, I think:
trait Foo {
fn foo(&self);
}
trait Bar : Foo {}
impl Foo for () {
fn foo(&self) { println!("Hello") }
}
impl Bar for () {}
fn xxx(x: &dyn Bar) {
x.foo();
}
pub fn main() {
xxx(&());
}
> With the current beta version you can upcastRight. Now you can convert from `&dyn Bar` to `&dyn Foo` which wasn't possible before.