Hacker News new | ask | show | jobs
by becquerel 1375 days ago
Is Rust old enough for there to be a 'modern' Rust?
7 comments

Yeah, not really. The only big changes to the language core were non lexical lifetimes, match ergonomics, lifetime elision, auto-deref, and async, although all of these are already so old now that I wouldn't consider them constituents of modern Rust; they're just (unqualified) Rust at this point.

Releases tend to bring some minor improvements like functions you wished had always existed or making non-const functions const, but that's pretty much it. Rust is a remarkably stable language.

Code that predates the 2018 edition can have some cruft, especially with respect to the module system.
These are relatively minor things, and most of them can be cleaned up with `cargo fix` and `cargo clippy --fix`.
You can't run `cargo fix` on blog posts from 2017
I think so? Modern c++ (c++11) came 13 years after c++98. Rust has been released for close to or longer than that depending on your definition of released.
Note that while C++98, the first standard came out in 1998, the first public release of C++ was in 1985, so it's more like 26 years
Yeah, I remember looking at C++ sometime in the 80s. If memory does not evade me I think it was preprocessor back then.
Rust has improved in a number of significant ways since 1.0, those improvements are things that make it easier to work with in a number of ways. One way to think about this topic is if you found the language too hard in the beginning you may find it easier to work with now.

Also, since it was released a lot of patterns have evolved to work around the restrictions the language puts in place, and those are good to learn.

sort of? when i first learned it there was no async/await, no `?` operator for simplifying error handling, and lifetime elision was a whole other story, and you seemed to need lifetimes for any reference (can't remember but it's much better now). But is that really enough change for a new kind of rust (instead of just say, learning async rust vs normal rust?). not sure.
Isn't this what "editions" are supposed to handle, in part?
Editions are only necessary for otherwise-backwards-incompatible changes, to avoid breaking existing code. Even relatively major language features like the ? operator were shipped without an edition bump. But for example I think the await keyword itself was added as part of an edition, because it was incompatible with existing code that had a method named await.

The messaging around the 2018 edition was a little different here, with some attempts to use the edition release as an opportunity to advertise and summarize all the features that had shipped since 2015. But I think folks decided that was confusing, and with the 2021 edition the messaging was toned down.

Yes, that's a fair point about the actual purpose of editions being to handle forwards-compatibility.

Informally though, I think there are certainly a subset of people that use "Rust 2021" to mean all of the features included up to that point, even if it's not the precise definition.

Arguably it's young enough that all Rust is 'modern' Rust.
Code from before match ergonomics and NLLs definitely feels pre-modern.
If this was JavaScript, the current modern would be old school by the time I finish writing this sentence.
No, that sort of talk isn’t helpful.