Side note, if anyone is interested in hearing more from Matt, he has a programming podcast with Ben Rady called Two's Complement. https://www.twoscomplement.org
+1, especially loved the episode from a couple months back about using AI tools in development. Really got me thinking differently about the role of AI in a developer's workflow and how software development will evolve.
Matt Godbolt sold me on Rust by showing me C++
71–80 of 675 posts
Re: Matt Godbolt sold me on Rust by showing me C++
#72The one thing that sold me on Rust (going from C++) was that there is a single way errors are propagated: the Result type. No need to bother with exceptions, functions returning bool, functions returning 0 on success, functions returning 0 on error, functions returning -1 on error, functions returning negative errno on error, functions taking optional pointer to bool to indicate error (optionally), functions taking r…
I like so much about Rust. But I hear compiling is too slow. Is it a serious problem in practice?
Re: Matt Godbolt sold me on Rust by showing me C++
#73Re: Matt Godbolt sold me on Rust by showing me C++
#74Earlier quoted context omitted.
I like so much about Rust. But I hear compiling is too slow. Is it a serious problem in practice?
People who say "Rust compiling is so slow" have never experienced what building large projects was like in the mid-1990s or so. It's totally fine. Besides, there's also https://xkcd.com/303/
Re: Matt Godbolt sold me on Rust by showing me C++
#75Right. I attempted using Rust for trading-related code as well. However, I failed to write a dynamically linked always sorted order book where you can splice orders in the middle. It is just too dynamic for Rust. Borrow checker killed me. And don't get me started on dynamic graphs. I would happily use Rust over C++ if it had all other improvements but similar memory management. I am completely unproductive with Rust…
Re: Matt Godbolt sold me on Rust by showing me C++
#76There is '-Wconversion' to catch things like this. It will however not trigger in this specific case since g++ assumes converting 1000.0 to 1000 is ok due to no loss in precision. Quantity(100) is counterproductive here, as that doesn't narrow the type, it does the opposite, it casts whatever value is given to the type, so even Quantity(100.5) will still work, while just plain 100.5 would have given an error with '-W…
> -Wconversion ... assumes converting 1000.0 to 1000 is ok due to no loss in precision. Additionally, `clang-tidy` catches this via `bugprone-narrowing-conversions` and your linter will alert if properly configured.
I do run clippy on my Rust projects, but that's a matter of style and readability, not correctness (for the most part!).
Re: Matt Godbolt sold me on Rust by showing me C++
#77Earlier quoted context omitted.
I like so much about Rust. But I hear compiling is too slow. Is it a serious problem in practice?
Absolutely, the compile times are the biggest drawback IMO. Everywhere I've been that built large systems in Rust eventually ends up spending a good amount of dev time trying to get CI/CD pipeline times to something sane. Besides developer productivity it can be an issue when you need a critical fix to go out quickly and your pipelines take 60+ minutes.
Re: Matt Godbolt sold me on Rust by showing me C++
#78I see an article about how strict typing is better, but what would really be nice here is named parameters. I never want to go back to anonymous parameters.
I suppose it could still be added in the future; there are probably several syntax options that would be fully backward-compatible, without even needing a new Rust edition.
Re: Matt Godbolt sold me on Rust by showing me C++
#79Amazing example of how easy it is to get sucked into the rust love. Really sincerely these are really annoying parts of C++. The conversation function is more language issue. I don’t think there is a simple way of creating a rust equivalent version because C++ has implicit conversions. You could probably create a C++ style turbofish though, parse ([your string]) and have it throw or return std::expected. But you woul…
meh, rust is still better cos it’s friendlier
I have my gripes with rust, more it’s ecosystem and community that the core language though. I won’t ever say it’s a worse language than C++.
Re: Matt Godbolt sold me on Rust by showing me C++
#80Earlier quoted context omitted.
I like so much about Rust. But I hear compiling is too slow. Is it a serious problem in practice?
Absolutely, the compile times are the biggest drawback IMO. Everywhere I've been that built large systems in Rust eventually ends up spending a good amount of dev time trying to get CI/CD pipeline times to something sane. Besides developer productivity it can be an issue when you need a critical fix to go out quickly and your pipelines take 60+ minutes.