News for hackers. Stuff that matters.
Re:The Rust I wanted had no future by FpUser on Monday June 05, 2023 @07:22PM (#36205731)
>"Correct way is to check BEFORE you pop_back()"

Absolutely and this is exactly what I do. I always check the containers before removing elements.

>"In Rust, any number of invocation of pop() will not result in undefined behavior. You can ignore the value, or you can check it, but it doesn't expose you to UB just for slightly misusing a vector."

I do not understand "slightly misusing" part. I assume in Rust it would bomb if pop() returns "none" and you try for example add said "none" to some number.

Re:The Rust I wanted had no future by aldonius on Tuesday June 06, 2023 @12:09AM (#36207969)
Vec<T>::pop() and similar methods return an Option<T>, so it's a compile-time type error to just add a number to it directly.
Re:The Rust I wanted had no future by Ygg2 on Tuesday June 06, 2023 @05:39AM (#36210322)
> I assume in Rust it would bomb if pop()

That's the thing. It wouldn't. Worse you can do is make whole program panic, with well defined stack trace and message.

It will never return non-sense and pretend all is ok.