News for hackers. Stuff that matters.
Re:The Rust I wanted had no future by intelVISA on Monday June 05, 2023 @07:48AM (#36195006)
The fatal mistake here is using the STL...
Re:The Rust I wanted had no future by tialaramex on Monday June 05, 2023 @09:47AM (#36196140)
The safe thing Rust did here is affordable in Rust (Option<T> is the same size as T for many T including all references) so they could afford to do it, whereas it's expensive in C++. Could it have been made cheaper in C++? Sure, but safety wasn't their priority so who cares?

That prioritisation applies to the whole ISO language, not only to the standard library.

Re:The Rust I wanted had no future by pjmlp on Monday June 05, 2023 @10:33AM (#36196702)
Re:The Rust I wanted had no future by tialaramex on Monday June 05, 2023 @05:34PM (#36204082)
You turned on a feature which helps diagnose this type of mistake at runtime, and it helped you by diagnosing the mistake at runtime. What does that prove?

What I'm talking about is that Rust's Option is very cheap in all the cases where it can be very cheap, which makes this whole design feature more affordable. C++ eventually grew std::optional which is not powerful enough for this work and yet is also bigger and slower. They could have done better, but safety wasn't a priority.

Re:The Rust I wanted had no future by pjmlp on Tuesday June 06, 2023 @02:57AM (#36209160)
It proves that there is a way to diagnose this type of mistake, that is what matters.

Unlike C, which the only way to be safe is not to touch it at all.

As for performance, ISO doesn't implement compilers, there are many ways to improve performance while keeping the semantics in line with the standard.

If the compiler vendors decide to focus elsewhere is another matter, a bit like there are languages as complex as Rust and compile faster, because that has been a concern, whereas rustc developers have their concerns elsewhere.

Re:The Rust I wanted had no future by Ygg2 on Tuesday June 06, 2023 @05:45AM (#36210356)
Still, catching errors at runtime is subpar compared to catching them at compile time.

Even your dynamic example won't tell me calling pop/push x/y times respectively will fail if x > y.

I have to trigger it somehow.

Re:The Rust I wanted had no future by pjmlp on Thursday June 08, 2023 @02:28AM (#36238037)
Since when does Rust support dependent typing?
Re:The Rust I wanted had no future by pjmlp on Monday June 05, 2023 @10:18AM (#36196516)
The fatal mistake is not enabling bounds checking, which most STL implementations support.
Re:The Rust I wanted had no future by intelVISA on Monday June 05, 2023 @01:47PM (#36200099)
-Wabsolutely-everything

I haven't written the Language of Kings in a while: does GCC -Wall truly enable all warnings yet?

Re:The Rust I wanted had no future by staunton on Monday June 05, 2023 @02:35PM (#36200919)
Obviously not. It would be an instant scandal if they tried that.
Re:The Rust I wanted had no future by astrange on Monday June 05, 2023 @09:13PM (#36206789)
It doesn't, and that would be a bad thing, because warnings aren't magic and bug-free themselves. Nor is there any reason to comply with every single warning every person in the world has come up with.

clang has a -Weverything and it isn't supported.