News for hackers. Stuff that matters.
Re:I can't keep up with idiomatic Rust by adamnemecek on Wednesday April 08, 2020 @09:49PM (#22819090)
No, it's nothing like C++. The only recent big change was async but how many other things have changed?
Re:I can't keep up with idiomatic Rust by ajross on Thursday April 09, 2020 @12:52AM (#22819882)
The linked article is literally a list of things that are changing too rapidly in Rust to keep up with. Maybe those don't qualify as "big" changes, but then most of C++'s evolution was an aggregation of features that were in isolation fairly small and focused.
Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @01:03AM (#22819920)
The changes:

* .await. This feature was in development for almost five years. Landed November 2019. This is a legit new feature, with significant ramifications on the language.

* try!() -> ? . This feature was in development for two years, and landed in November 2016. This largely consists of the transformation "try!(x)" to "x?".

* impl trait: this feature was in development for two years, and landed in May of 2018. This has two major parts: one that is very rarely used that is mostly sugar, and another that's pretty useful, and is a legit new feature.

* dyn: this feature was in development for two years, and landed in June of 2018. This is largely optionally adding `dyn` in some places. You don't have to do this. You can turn a lint on that will tell you exactly where to do this, and it can be automatically added to your code.

So that's four features. One of them three years ago, two two years ago, and one last year.

Re:I can't keep up with idiomatic Rust by DeathArrow on Thursday April 09, 2020 @01:41AM (#22820115)
That's awful hard. People have to learn an entire new feature each year? :D

I don't get why people complain. C# is pumping features at a much higher rate and most people are glad. Those features do solve some issues or make it easier to solve them. If you don't have an use case for them, then you don't need to learn them.

Re:I can't keep up with idiomatic Rust by ajross on Thursday April 09, 2020 @11:03AM (#22823205)
Sure, but if you list out C++'s warts, you'll find a much longer list spread out over 30 years. The same effect holds, no?
Re:I can't keep up with idiomatic Rust by estebank on Thursday April 09, 2020 @12:55PM (#22824562)
Not necessarily. The way that new features fit together with existing features has a big impact on how useful and beneficial adding those features are.

In C++, using modern style is .a nicer experience, but at the cost of having to stay away from any code pre-C++11. This is not because C++ designers are bad, but rather because they have more cruft due to existing for longer. Time will tell if Rust will go down that same road, but right now new features fit with the rest of the language and are usually extensions to things that already exist but that weren't allowed in places.

Re:I can't keep up with idiomatic Rust by ajross on Thursday April 09, 2020 @06:06PM (#22827702)
But... again... the contention of the linked article, and one I share, is that these new features don't "fit with the rest of the language" and keeping up with them represents needless cognitive churn.

I mean, sure, that's an opinion thing, and obviously you don't share it. But to me, watching from outside the core rust community, it sure seems like exactly the same thing that happened to C++.

Re:I can't keep up with idiomatic Rust by dralley on Friday April 10, 2020 @11:07PM (#22839380)
It really, really, really needs to be stated that the thing that triggered this whole discussion is not a "new feature", it is not even an RFC, it is a blog post written by a prolific Rust developer who also turned the idea into a library, and wanted to share the merits of the idea.

The fact that it's controversial and "doesn't fit with the rest of the language" means it will very likely never become an RFC in its current state, much less become part of the language.

There is no need for the author to make constant changes to his code. It will continue compiling just fine. Moreover, new "editions" come along with nice documentation on what changed and tooling to automatically fixup code, and are totally opt-in. You can simply wait for a new edition to come along to update your code -- or not, it doesn't ultimately matter that much.

Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @12:26PM (#22824135)
I mostly wrote C++98, or at least, C++ of that vintage, so I can't really speak to how hard it is to keep up with later C++ standards. Just providing more context for those specific list of changes, and their frequency.
Re:I can't keep up with idiomatic Rust by jfkebwjsbx on Wednesday April 08, 2020 @09:56PM (#22819112)
Almost the entire language since its early days. And there have been 2 major editions in the last 5 years.
Re:I can't keep up with idiomatic Rust by gamegoblin on Wednesday April 08, 2020 @10:05PM (#22819151)
I don't think it's really fair to talk about pre-1.0 language changes -- by definition, being pre-1.0 typically implies a lack of stability. One of the major editions you mention is the 1.0 release.

So, there has been 1 new edition since 1.0, and, as the parent comment says, the only really groundbreaking change since 1.0 is the stabilization of async support.

Other changes, such as the `dyn` keyword and match ergonomics are mostly superficial, and things such as NLL and additional lifetime elisions are just simple quality of life improvements that don't fundamentally change the language.

Re:I can't keep up with idiomatic Rust by geofft on Thursday April 09, 2020 @12:52AM (#22819879)
Not only is it unfair, it's counterproductive - the lesson future languages will learn is to not work in public and to not improve. Rust pre-1.0 was a mess and nobody would have been better off if it had gotten frozen with all the not-so-great stuff officially supported.
Re:I can't keep up with idiomatic Rust by ekidd on Wednesday April 08, 2020 @10:12PM (#22819190)
I've been writing Rust since before 1.0, and I maintain at least once piece of 5-year-old production Rust code.

In general, old Rust code continues to work almost completely unchanged. There have been 3 or 4 cases where I couldn't compile an ancient dependency because it was relying on something weird like a soundness bug. The fix was usually to update the dependency to the latest minor revision.

Rust 2018 fixed a few minor syntactic issues, adding the "crate" keyword for imports from the current crate, and "dyn" in front of dynamically dispatched traits. These can both be updated using 'cargo fix' in about 20 minutes. Rust 2018 modules can use Rust 2015 modules almost completely seemlessly, even when macros are involved.

Is it perfect? No. But updating older code is something I spend a day or two a year on.

Re:I can't keep up with idiomatic Rust by jfkebwjsbx on Thursday April 09, 2020 @04:25AM (#22820731)
That is fine, but note that 2 days a year is about 1% of work time, and that time increases as the code size increases.

Moreover, in some companies you cannot simply update external dependencies without extra painful reviews.

Re:I can't keep up with idiomatic Rust by kccqzy on Wednesday April 08, 2020 @10:27PM (#22819254)
If by "its early days" you want to talk about pre-1.0 Rust, then I think a fair comparison is pre-C++98 C++, from the original Cfront. At that time C++ was just C with classes. It didn't have templates, namespaces, and plenty of other indispensable features in modern C++.
Re:I can't keep up with idiomatic Rust by artursapek on Wednesday April 08, 2020 @11:02PM (#22819396)
Bryan Cantrill's talk about Rust addresses when they removed green threads, and how much of a bold, disruptive change that was. He remarks on how that impressed him with the Rust community and made him follow the language more closely - had they been too scared to change the language in drastic ways, we would still be stuck with green threads.

Sorry, I can't remember the timestamp right now but the entire thing is worth a listen:

https://www.youtube.com/watch?v=LjFM8vw3pbU

Re:I can't keep up with idiomatic Rust by steveklabnik on Thursday April 09, 2020 @10:29AM (#22822847)
And to be clear, this was before 1.0; we cannot do this kind of thing these days.
Re:I can't keep up with idiomatic Rust by iknowstuff on Wednesday April 08, 2020 @10:07PM (#22819167)
You mean pre-1.0. There has been one major edition afterwards, Rust 2018, which is optional but has awesome new features like non-lexical lifetimes, async/await keywords and I guess `dyn`.
Re:I can't keep up with idiomatic Rust by bschwindHN on Wednesday April 08, 2020 @10:04PM (#22819148)
I would only count language changes since its 1.0 release, there really haven't been that many.
Re:I can't keep up with idiomatic Rust by jfkebwjsbx on Thursday April 09, 2020 @04:08AM (#22820665)
That's fair, then 1 major edition. There have been a lot of added features, though.

I am not sure why people downvoted me.

Re:I can't keep up with idiomatic Rust by kibwen on Thursday April 09, 2020 @10:04AM (#22822632)
In the parlance of the Rust developers, a "feature" is often just the addition of a single function to the standard library. The only remotely paradigm-shifting feature to be added since 1.0 was async/await; the other things mentioned in the blog post are minor QOL nice-to-haves.