News for hackers. Stuff that matters.
Re:Things you can’t do in Rust (and what to do instead) by stagger87 on Saturday May 15, 2021 @10:44AM (#27165638)
Presumably you've read enough to know that memory safety and UB are Rust's biggest selling points? If that hasn't convinced you already, I'm not sure what would. Just keep using C++.

(I use C++ and I love it.)

Re:Things you can’t do in Rust (and what to do instead) by benreesman on Saturday May 15, 2021 @10:48AM (#27165676)
I have forlorn hopes that Rust will fix build times and I'll tolerate the abusive relationship with the borrow checker if it can move the needle on that.
Re:Things you can’t do in Rust (and what to do instead) by firethief on Saturday May 15, 2021 @11:07AM (#27165865)
Fighting with the borrow checker is just a phase you have to get through, it will click. The need to write anything that can't be done without unsafety is rare (probably never unless you are writing a data structure library).
Re:Things you can’t do in Rust (and what to do instead) by monoideism on Saturday May 15, 2021 @11:05AM (#27165831)
> UB

Undefined behavior? As in, you can confine it to `unsafe`?

Re:Things you can’t do in Rust (and what to do instead) by tialaramex on Saturday May 15, 2021 @12:26PM (#27166589)
Unsafe Code isn't allowed to have Undefined Behaviour either.

What unsafe does, is it says to the compiler:

"Hey, I know you're just a dumb machine, and you couldn't prove this code obeys all the rules that keep Rust safe, but I am very smart and I promise it actually is safe". You're also encouraged to explain yourself (to other humans, not the compiler, this isn't Wuffs) so that anybody else maintaining the code can see why exactly you believed this was OK.

Over the years, some code which was once unsafe in Rust no longer needed an unsafe block, because Rust's compiler got smarter, "Oh, I see why this is OK".

But if your unsafe code has Undefined Behaviour that's actually a serious bug, it's not what unsafe is for at all.

Re:Things you can’t do in Rust (and what to do instead) by monoideism on Sunday May 16, 2021 @09:27PM (#27179119)
That's what I thought, or at least suspected, so not sure why "UB" was listed as a Rust selling point.
Re:Things you can’t do in Rust (and what to do instead) by tialaramex on Sunday May 16, 2021 @10:47PM (#27179609)
I am not the poster in question, but I assume that they meant Rust avoids Undefined Behaviour and this is indeed a notable selling point, compared to low-level languages.