6 ms·
Is Rust old enough for there to be a 'modern' Rust?
by becquerel 4y ago
Is Rust old enough for there to be a 'modern' Rust?
- treeman79 4y agoIf this was JavaScript, the current modern would be old school by the time I finish writing this sentence.
- nindalf 4y agoNo, that sort of talk isn’t helpful.
- adamdusty 4y agoI 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.
- bluejekyll 4y agoRust 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.
- bobbylarrybobby 4y agoYeah, 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.
- duped 4y agoCode that predates the 2018 edition can have some cruft, especially with respect to the module system.
- nicoburns 4y agoArguably it's young enough that all Rust is 'modern' Rust.
- School-Cotton 4y agoCode from before match ergonomics and NLLs definitely feels pre-modern.
- efficax 4y agosort 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.
- jen20 4y agoIsn't this what "editions" are supposed to handle, in part?
- oconnor663 4y agoEditions 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.
- jen20 4y agoYes, 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.
- deleted 4y ago[deleted]