News for hackers. Stuff that matters.
Re:Sayonara, C++, and Hello to Rust by rapsey on Tuesday December 07, 2021 @02:07AM (#29469787)
Rust is not that new and shiny anymore.
Re:Sayonara, C++, and Hello to Rust by nindalf on Tuesday December 07, 2021 @02:24AM (#29469876)
Maybe that’s why they named it Rust. It sounds old and boring.
Re:Sayonara, C++, and Hello to Rust by FridgeSeal on Tuesday December 07, 2021 @03:27AM (#29470220)
For a bit of trivia, I believe it’s named after a fungus.
Re:Sayonara, C++, and Hello to Rust by nlitened on Tuesday December 07, 2021 @02:13AM (#29469812)
It has a new edition every year though :)
Re:Sayonara, C++, and Hello to Rust by rapsey on Tuesday December 07, 2021 @02:16AM (#29469829)
No it does not. 2015, 2018, 2021. With the 2021 changes so small few projects actually required any changes to be compatible from 2018.
Re:Sayonara, C++, and Hello to Rust by nindalf on Tuesday December 07, 2021 @02:35AM (#29469933)
The 2021 changes could be applied with an autofix tool - “cargo fix --edition”.

Most of these changes are small paper cuts that make sense to fix, but they’re breaking changes so they need to be opted into explicitly.

For example, earlier use a field x of struct b in a closure would capture the ownership of the whole of b. In rust 2021, the closure will only take ownership of b.x. This makes sense, but it’s a breaking change and therefore it needs an opt-in.

The Edition system is one of Rust’s biggest strengths IMO. Some languages never make breaking changes be enough if they’re small because it would break too much code. Other languages make breaking changes but expect users to migrate, placing a burden on them. The Rust edition system leaves it up to the user, on a per-crate (package) basis. Staying on the old edition is perfectly acceptable, as is moving to the new one.

Further reading - https://doc.rust-lang.org/edition-guide/rust-2021/

Re:Sayonara, C++, and Hello to Rust by GolDDranks on Tuesday December 07, 2021 @02:17AM (#29469831)
*every three years, actually. The current one is 2021, the one before that was 2018 and the (implicit) first one 2015.