Readit News logoReadit News
pornel · 6 years ago
Rust seems to change constantly, because it's changing so slowly. The 1.0 release has held back a lot of stuff to avoid stabilizing wrong things, and it's now slowly backfilling the missing features bit by bit.

Instead of starting with a fat standard library, it started with minimal one and now each release adds 2-3 functions that could have been there in 2015. But none of it is idiom-changing revolution. These are mostly convenience functions, and you don't have to use them all just because they're there.

Every addition to the language is bikeshedded to death, goes through betas, revisions, refinements, before being stabilized years later. The first experimental release of async was 4 years ago and it has landed last November. So you may hear about new features a lot and they churn in nightlies, but actual big changes reach stable rarely.

Apart from async/await, since 2015 Rust made only 2 changes to how idiomatic code looks like (? for errors, and 2018 modules), and both of them can be applied to code automatically. I maintain over 60 Rust crates, some of them as old as Rust itself. All work fine as they are, and running `cargo fix` once was enough to keep them looking idiomatic.

twic · 6 years ago
> it's now slowly backfilling the missing features bit by bit

This isn't slow.

Java went three years, from December 1998 to February 2002, without any language changes. And to be honest, even that wasn't that slow!

> Every addition to the language is bikeshedded to death

Not to death, because many of them don't die!

What i find annoying about Rust's changes is that some of them are so trivial - they change the language for such small improvements. async/await is not in that category, for sure. But Ok-wrapping actually is. The need to Ok-wrap results is a minor annoyance at most. Ditto a bunch of the problems solved by match ergonomics changes.

I think the root of the problem is that the changes are driven by a small core of Rust programmers - many working on Rust itself or some of its flagship projects - who are actively involved in the discussions around Rust. They tend to view change as natural, and the cost of change as low. I believe there is a larger group of Rust programmers who are not actively involved in these discussions, and are maybe not spending 100% of their time on Rust, for who the cost is higher. But we don't hear as much from them.

hinkley · 6 years ago
> Java went three years, from December 1998 to February 2002

Oh hell no.

Sun was widely criticized for that boneheaded move, and for the whiplash everyone experienced in Java 5 when they changed that policy too fast.

The mass of changes in 5 left a lot of tools and thus people stuck in 1.4 for years. I started on a project a bit before 6 came out. It was processing data and I couldn’t use the collections API, because it had to run on an embedded system and Aicas was taking their sweet time catching up with all those changes. Four years later I was still using arrays for everything.

ChrisSD · 6 years ago
`match` ergonomics don't affect already working code.

Ok-wrapping isn't a change that's been made. At best it's a hypothetical change that one person wanted to have a calm, rational discussion about with the community. Instead we get this.

sgift · 6 years ago
> What i find annoying about Rust's changes is that some of them are so trivial - they change the language for such small improvements. async/await is not in that category, for sure. But Ok-wrapping actually is. The need to Ok-wrap results is a minor annoyance at most. Ditto a bunch of the problems solved by match ergonomics changes.

So what? Then don't use them. The whole point of full backward compatibility is that you don't have to use new features. This perceived need to always use the newest feature is only in the head of some developers.

Neither in the blog post nor here do I see any reason to not make the experience better for people who want it. Even if it's just a "minor" (very subjective, I love the match ergonomics enhancements) annoyance that's fixed by it.

rubber_duck · 6 years ago
> I believe there is a larger group of Rust programmers

Is there ? This is a genuine question - I've tried rust back in 2013 and have been following it from the outside not using it for anything serious since I haven't had a use case. My impression is that it's still a niche language with and their user base seems to be very involved and engaged. It don't have the impression that there are a lot of companies that are "just doing their job with Rust and not making a lot of noise about it" - if a company is using Rust for something it's probably writing an engineering blogpost about it and the guy who spearheaded it is probably active within the community. I'm just basing this on the amount of Rust posts vs the amount of Rust use/job postings in those quiet, doing their thing companies.

Deleted Comment

jkoudys · 6 years ago
I _really_ felt that in JavaScript, especially es2015. So many updates came out at once, that people didn't realize many of the benefits they received from new features were now much less important because of other features that were included around the same time.

There was a huge rush to use classes, which was sugar around the prototype system, but happened when we also got spread operators, Object.assign, and property name shorthand. We could already easily express the concept of a class far more easily than we were doing before, but because it all came out at the same time it didn't really click for the community at large and a lot of what became idiomatic didn't really feel important enough for a language update.

Ditto with generators and async functions, which while merely a very specific application of a generator is far better known. Again, not sure we needed all this extra syntax so you can say `async function foo() { await bar()`, when `co(function* foo() { yield bar()` was already available (if co were simply added to the Promise object). We're also now tying the language to a very specific implementation, when the co approach is explicit about saying what's responsible for taking control from the yielded function (a Promise).

ddevault · 6 years ago
C adds 2-3 features every 10-20 years. That's slow. Rust is not slow.
mseepgood · 6 years ago
> C adds 2-3 features every 10-20 years.

This should be the norm for serious programming languages. Anything else is a hyperactive children's toy.

k__ · 6 years ago
I can't comprehend what you're going at.

Are they to slow and doing too much design by comitee or are they at an okay speed of innovation?

ekidd · 6 years ago
I spent today updating some production Rust code from 2016. This was a partly automated process thanks to 'cargo fix'.

Some thoughts:

1. Most of the superficial changes, like 'dyn' and Rust 2018, are easily handled using automatic tools.

2. The original Rust 'Error' trait was clunky, and it lacked useful features like backtrace support. This led to a series of experiments and fads in error handling (e.g., error-chain, failure), which are only starting to calm down after recent enhancements to 'Error'. More conservative Rust users avoided this by sticking with 'Error' and living with the limitations.

3. Updating depencies has been surprisingly easy, with several notable exceptions. Very early adopters of 'tokio' 0.1 had a fair bit of work to do once 'async' stabilized. And OpenSSL has been a constant thorn in my side, despite being a native C dependency.

One handy tip: Don't force yourself to constantly update your code to use all the latest features. Not everything needs to be async. And it's OK to have some rarely-touched modules that are written like it's 2015.

saghm · 6 years ago
> And OpenSSL has been a constant thorn in my side, despite being a native C dependency

If it's acceptable for your use case, it might be worth taking a look at rustls. I'm not sure how far along it was back in 2016, but it's in a pretty good state right now. I consider it much easier to deal with than OpenSSL, and the fact that a lot of legacy crypto that I have no need for isn't even supported in the library is appealing at least to me.

oconnor663 · 6 years ago
> And it's OK to have some rarely-touched modules that are written like it's 2015.

Indeed, the Rust compiler team has done a ton of work to build the "editions" system, so that you can do just that.

d1plo1d · 6 years ago
As someone newer to Rust who has been using error-chain because it was what I found at the time I'd be curious to hear what your preferred solution to errors in modern rust is.
steveklabnik · 6 years ago
https://blog.yoshuawuyts.com/error-handling-survey/ is a good summary of what's out there.

I think current rough consensus is anyhow/thiserr depending on if you're writing an application or library. I haven't actually used them myself, though. You don't have to keep up with the cool new libraries.

charliesome · 6 years ago
As the kind of more conservative Rust user GP references, I've had a great time with the derive_more crate's From derive [0].

This lets me write code like this:

    #[derive(From, Debug)]
    pub enum SomeSpecificError {
        Io(io::Error),
        SomeAppLevelErrorCondition,
    }

    fn do_something() -> Result<(), SomeSpecificError> {
        do_some_io()?;
        // ...
    }
Previously I would have written:

    fn do_something() -> Result<(), SomeSpecificError> {
        do_some_io().map_err(SomeSpecificError::Io)?;
    }
I find this approach results in clear code that continues to compile and work just fine over time, even as everything changes around it.

[0] https://jeltef.github.io/derive_more/derive_more/from.html#e...

ShorsHammer · 6 years ago
Failure is really nice to use.

Might suit some people.

https://github.com/rust-lang-nursery/failure

hinkley · 6 years ago
I feel like error handling in Node hit a nadir in 10.0 due to async function stack traces being so truncated. I started in the industry when Java was young and while I appreciated stack traces plenty, I hardly ever had to deal again without them, and you really do come to depend quite a lot on this behavior.

Officially we are upgrading to 12 for perf, but I was the first (and will probably be the primary) contributor to that work because I want everyone to have decent stack traces again. Our code has too many layers of abstraction, and working without full traces is adding insult to injury.

roca · 6 years ago
I feel that the changes to date haven't been that significant. Adding `dyn` was almost completely automated, removing the need for `extern crate` was welcome and very easy to apply, likewise `try!()` to `?`. The changes to futures were a bit of a pain but futures were always known to be in flux. `impl Trait` is useful but failing to use it where you could is not ugly enough to irritate.

There are some upcoming improvements --- that I'd like to see! --- that are bigger and thus may be more challenging:

-- Better `const fn` will make many existing `lazy_static`s become unidiomatic. Worth it, but annoying.

-- Const generics will make a lot of existing code non-idiomatic. Again, well worth it, but annoying.

-- Generic Associated Types ... probably similar.

The question is, if people decided those important features don't belong in Rust because they would cause too much churn in code that wants to be idiomatic ... then what? That would almost guarantee a new language --- perhaps a fork of Rust, perhaps not --- would eventually fill that niche. Wouldn't everyone be better off if that language was Rust itself, and people who don't want to write that "modern code" ... don't?

swalladge · 6 years ago
> Wouldn't everyone be better off if that language was Rust itself, and people who don't want to write that "modern code" ... don't?

Agreed. The author's whole argument of not wanting "having to make these superficial changes again and again" doesn't make sense. There isn't any requirement for all code to follow the latest and greatest idioms. Rust guarantees backwards compatibility, and the author even acknowledges that in the article.

It would be pretty sad if the reason for no new features or syntax in Rust was due to programmers not wanting to feel like their code was no longer idiomatic.

hinkley · 6 years ago
I think it depends on whether you are working full time in Rust or as a hobbyist trying to break in.

I gave up on EmberJS around the same time because I only got a five hour chunk of time every couple of weeks and they were making semantic changes so frequently then that it felt like I spent half of my time upgrading my code to work with the changes. It ended up being a major factor in killing that project for me and I’m just now getting back to it.

sedatk · 6 years ago
Wow, he said he got stuck with Rust 2015 and I thought Rust wasn’t keeping backwards compatibility, like earlier Swift. Not cool.
lmm · 6 years ago
> The question is, if people decided those important features don't belong in Rust because they would cause too much churn in code that wants to be idiomatic ... then what? That would almost guarantee a new language --- perhaps a fork of Rust, perhaps not --- would eventually fill that niche. Wouldn't everyone be better off if that language was Rust itself, and people who don't want to write that "modern code" ... don't?

A lot of these things feel like cases where Rust isn't really advancing the state of the art and could have just followed what existing languages do. Like, Rust takes some inspiration from OCaml, but OCaml already had good answers to these questions (railway-oriented-programming style composition for error handling, LWT for async, first-class modules for existentials). If Rust had been designed more wholeheartedly as "OCaml but replace garbage collection with a borrow checker", I think it would have got to a pretty similar place to where it is now (not in terms of the specific approaches, but in terms of how good the language is at solving those problems) more quickly and with less churn. Over the years I've concluded that the correct number of major innovations in a new language is one; Rust's is the borrow checker, so it really doesn't need to also try to reinvent error handling from the ground up.

At a more specific level, if the language put more effort into making it easier to manipulate first-class functions (while handling ownership correctly) rather than language-level control flow keywords, then a lot of this churn could have happened "in userspace": different approaches to async or error handling would be library changes rather than language changes.

roca · 6 years ago
I don't think it makes sense to design a language by picking the closest existing suitable language and adding one major innovation. You want to do the minimal innovation necessary to achieve your goals --- no more, no less.

Rust designers did consciously try to minimize innovation. To that end, Rust error handling is linguistically parsimonious: the standard library Result type used idiomatically, plus the ? operator (itself very simple). To the extent it innovated, it did so by excluding dynamic exception throw/catch and dedicated error result syntax from the language.

Rust async/await is also not unnecessarily innovative. At heart it is the same as async/await in JS and C#. Getting it to work with the Rust ownership model was hard and did require some innovation. LWT was dropped from Rust because it was not compatible with Rust's goals.

Likewise, higher-kinded types aren't especially innovative but will require significant work to flesh out for Rust because of the ownership system.

fluffything · 6 years ago
It took 20 years to get OCaml where it is. You can always wait another 20 years, and only start using Rust then.

Otherwise, it seems to me that what you are asking is "Why didn't the Rust developers ship a 20 year old language on day 1?".

jfkebwjsbx · 6 years ago
Rust isn't meant to be functional but rather a redesigned C++, even if it draws a lot of inspiration from OCaml and friends.

So I can see why they went with something different for error handling.

mlindner · 6 years ago
They do belong in Rust, but they don't belong in a minor version release. There was Rust 2015, and then there was Rust 2018, we can put them in Rust 2021 (assuming 3 year cycle). Don't put major new forward compatibility breaking features in a minor release.
roca · 6 years ago
How would putting them in a new edition help in practice?
hinkley · 6 years ago
I missed it myself but have heard that people had to torture some of their code to deal with the object lifetime limitations in older versions. I’m sure that echoes of this still show up as quirkiness in various libraries.
CJefferson · 6 years ago
async is huge, and I'm worried about future similar changes.

Suddenly "x.y" means member access.. except for x.await, which has a magic different meaning I still don't really understand. And adding 'await' to a function declaration magicly mangles it in various ways.

hamaluik · 6 years ago
If you’re interested, I found this blog post [1] a really solid introduction to what async / await are in Rust, and how they’re used.

[1] https://os.phil-opp.com/async-await/

roca · 6 years ago
Honestly I haven't found those things to be problems at all. ".await" really isn't confusing. I think you meant "adding 'async'" to a function declaration --- it seems fine, but I personally don't use it.
red75prime · 6 years ago
You can always write `fn foo() -> impl Future` and mangle your code manually, using future combinators, though.
ragnese · 6 years ago
I do agree. The syntax they chose was not my favorite option. I wish they at least had put the stupid parentheses, so you can think of awaiting as an operation that the compiler "magically" puts on Futures in async contexts.

I know that's not technically right, but it still seems a better approximation to reality.

gautamcgoel · 6 years ago
This a key difference between the Go community and the Rust community. Go is like C 2.0: it tries to be minimal and stable. Go usually ships with no language changes between releases. Rust is like C++ 2.0: it is constantly being revised and expanded, supposedly to improve power, performance, and ergonomics. When a new version of Rust is released, the core Rust devs write a blog post gleefully explaining all the new "features" the current version has. What these devs perhaps fail to appreciate is that not having new features can itself be a feature.
dilap · 6 years ago
I'm a Go fan and I've used it tons; I'm Rust-curious, but I've only made toy programs w/ it. While there is a germ of truth to this -- C++ and Rust are both complex -- I think it carries w/ it a lot of connotations which are untrue.

To wit, C++ is a brutal, terribly designed mess that's absolute torture to work with.

Rust is extremely well-designed and a pleasure to work with.

Very important difference!

inimino · 6 years ago
C++ is two and a half decades older than Rust. Come back to this comment in 25 years and see how well the pleasure of Rust's design has held up.
aloknnikhil · 6 years ago
Pre-C++11 was. Modern C++ not so much. Things have drastically improved and dare I say, it's more appropriate to call C++11 and greater C++ v2. That said the tooling around build/test/dependency management/versioning leave much to be desired for. But a combination of meson (for build), Catch (for test) and CMake for dependency management can go a long way.

Dead Comment

littlestymaar · 6 years ago
We hear this narrative really often even though it's not accurate: Go has its share of outrage about one change (in error handling too amusingly) last year and the proposal (the try keyword) even had to be repealed because it was considered too revolutionary. Go modules are a huge change in how Go dependency management works and it's comparable, or even bigger in scope, to the Rust changes in 2018 edition regarding modules. And in a near future, Go's generics (contracts) are going to be a dramatic change, in a scale Rust arguably hasn't faced yet since 1.0, even though there is some similarities with the impl Trait features.

In fact, Go and Rust are both evolving fast compared to C (and maybe even to C++) and interestingly enough, most of the time the evolution comes in similar domains (error handling, modules, generics).

The big difference is the release schedule: Rust release small changes often while Go release big changes rarely. The 6-weeks schedule has advantages (each version is quite small so it's easier to test and bugs are found earlier) but it adds a feeling of churn which can be harmful.

ldng · 6 years ago
The point is that Rust is changing too fast. Not that Go does not change ever.
Ar-Curunir · 6 years ago
Rust has only become more uniform and contains less special cases than just a couple of years ago.

The rate of adding features is quite slow, as demonstrated elsewhere in this thread. Important features spend a long time baking, and a long time in testing before they are piecewise stabilized.

> When a new version of Rust is released, the core Rust devs write a blog post gleefully explaining all the new "features" the current version has.

Of course when someone talks about a CHANGELOG, they'll talk (rather happily) about the things that have changed/improved.

lmm · 6 years ago
> Rust has only become more uniform and contains less special cases than just a couple of years ago.

How so? Aren't await and ? both new special cases?

umanwizard · 6 years ago
I don’t know any other “systems” language whose language definition changes every six weeks. When you say Rust changes slowly, what are you comparing it to?
Skunkleton · 6 years ago
IMO Go is more like C people took a stab at making a Java. I really like go, and it’s ethos, even if I haven’t used it much in production. Go is not however a replacement for C in the way C++ and Rust can be. Of course Rust and C++ aren't a replacement for C in some key ways, so maybe I don't have a point here?
typ · 6 years ago
It's been mentioned from time to time that Go is a successor of C. As I recently had a look into the Pascal/Oberon family. It looks that Go is no less influenced by Oberon than C. The CSP paradigm likely comes from Rob Pike's previous works. And the syntactical elements, such as the operators and punctuations, also follow the C tradition. But the overall program structure (including the approach to OOP and probably the 'evolving-by-reduction-rather-than-addition' philosophy) makes it seem closer to the Oberon linage.
SaxonRobber · 6 years ago
C++ has had decades to replace C, but it’s really stalled and even lost ground in embedded systems. I can’t see Rust faring much better. C might end up being an eternal language until there is a dramatic enough shift in operating systems to merit replacing it.
takeda · 6 years ago
> IMO Go is more like C people took a stab at making a Java.

And in a way it is :) given who worked on it, and where it was created.

pjmlp · 6 years ago
That was Limbo actually, and the attempt was at Java 1.0 apparently.

Despite my opinion regarding its design, Go was definitely a C replacement for F-Secure TamaGo, Google's gVisor, Android GPGPU and CoreBoot projects.

tmh88j · 6 years ago
>IMO Go is more like C people took a stab at making a Java.

I haven't used Go beyond tutorials and some very basic programs, but I am pretty comfortable with Java. What about Go makes you feel it's relatable to Java? From what I've read the lack of generics is a hot topic in the Go community, but they're pretty crucial to most programs written in Java. Is this still true?

phkahler · 6 years ago
Stability is THE most important feature. Rust needs to mature a little more and then mostly just stop. I seriously hope that it doesnt follow the C++ path.
steveklabnik · 6 years ago
Rust has made very strong stability guarantees.

Just today someone posted in /r/rust about how they took a two year old project, compiled it with the latest compiler, no issues. Other than it magically took less time to compile and the end result ran faster.

yahyaheee · 6 years ago
Yea I think this concept just doesn’t resonate deeply with the rust community for some reason
dodobirdlord · 6 years ago
> When a new version of Rust is released, the core Rust devs write a blog post gleefully explaining all the new "features" the current version has. What these devs perhaps fail to appreciate is that not having new features can itself be a feature.

Rust is trying to solve a set of problems, some combination of which exist in pretty much every programming language that exists today (including Rust). "Have you considered giving up?" is obviously not a very interesting question and not one that's going to get much traction.

Ar-Curunir · 6 years ago
What concept? Stagnation?
inimino · 6 years ago
Self-selection? There are already many other programming languages that appeal more to those who value elegance or minimalism, so those using Rust either lack the organ that senses elegance, or simply picked Rust anyway because of some other reasons.
throw_m239339 · 6 years ago
Go is more like static Python rather than C 2.0. I wish Go was C 2.0, but it isn't with its crazy reflection where one can do basically whatever they want, and garbage collector.

Rust is … just Rust.

graynk · 6 years ago
Static Python is Nim. Go is way more C-like with its structs and pointers
umanwizard · 6 years ago
Rust is OCaml disguised as c++ :)
banachtarski · 6 years ago
How is Go anything like a C 2.0. It's more of a server-side scripting language if anything
pjmlp · 6 years ago
When companies like F-Secure use it to write bare metal security firmware, CoreBoot uses it for UEFI firmware, or Google creates an hypervisor, TCP/IP stack and GPGPU debugger with it.
umanwizard · 6 years ago
C++ only changes every 3 years. It’s hardly comparable to Rust’s every-six-weeks churn.
adamnemecek · 6 years ago
No, it's nothing like C++. The only recent big change was async but how many other things have changed?
ajross · 6 years ago
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.
jfkebwjsbx · 6 years ago
Almost the entire language since its early days. And there have been 2 major editions in the last 5 years.
cies · 6 years ago
> The .await war was the final straw [...]

Interesting. I witnessed a constructive collaboration by which the Rust community chose (mainly) the syntax for it's async features. I thought of it as amazing, thoughtful, rather democratic and on point. Nothing war-like to me.

GolDDranks · 6 years ago
To be honest, reading mainly blog posts, RFCs and summarisation comments, it did look like a thoughtful and organised process. However, there has been a constant problem of tiresome work and "intellectual and emotional labour" of reading thousands pieces of feedback, some of which are emotionally charged, and many of which are duplicates or re-statements of similar ideas, and many of which have misunderstanding or mis-valuations of other ideas. I've heard that collecting and editing this huge amount of unstructured feedback into comprehensive and balanced summaries has been a huge drain of mental energy for the participants.
saghm · 6 years ago
I wasn't involved at all in the discussion, but having dove deep into async over the past few months since async/await was stabilized, I definitely am happy with the result of that process. Writing code with postfix `.await` feels very natural to me and it fits it much better with the surrounding code I write than a prefix version would. I can sympathize that participating in that process might not have been fun, but I really hope that the results of future discussions make me as happy as this one has.
Matthias247 · 6 years ago
I tried to contribute to the discussion and actually didn't find it to be super productive. We had thousands of comments just around syntax - from people who had never been involved in any async/await design or usage before. It was super hard for everyone involved to just keep up with the comments.

And while the syntax discussion saw a ton of comments, the more important underlying semantic aspects of async/await got a lot less attention - even though they also had and still have a few issues to resolve (e.g. around cancellation, thread safety, extensibility).

littlestymaar · 6 years ago
That's not really what happened : the core team decided they'd use ".await" instead of a regular prefix await (with good rational) and any people where pretty uneasy about that to say the least: most people considered that ultra ugly and confusing for new rust users (and I'm still in that camps even though I'm glad the discussion is finally over).

Here are the results of a survey ran on this syntax on about 400 Rust users from rust subreddit : https://i.redd.it/660zjw4rhsv21.png

You'd see the chosen syntax (field-like access) was one of the most disliked one…

dbrgn · 6 years ago
I used to dislike the "field-like access" syntax because I was used to "await" being a prefix in other languages, but using await many times in longer function call chains with multiple await calls has totally changed my mind. No need for nested parentheses. No need for splitting up the code just to make it more readable.

Syntax is something very emotional and beauty is very subjective. Thanks to the Rust team, the discussion around await syntax was mostly focussed on rational arguments, not around perceived beauty. The outcome is great in my opinion.

rob74 · 6 years ago
Maybe "await debate" would be more fitting then - and it rhymes too, which is always a plus...
kens · 6 years ago
> I need to now change my code in order to keep it idiomatic

I'm not a Rust person so maybe I'm missing something, but why does the OP need to keep the code idiomatic? Can't the changing fashions in what's idiomatic be ignored?

davidcuddeback · 6 years ago
> Can't the changing fashions in what's idiomatic be ignored?

They absolutely can, but you might be stuck on an older "edition" of Rust. I've stuck with `try!()` for error-handling, because I think error-handling deserves more prominence than a single character. But that means my code is stuck on Rust 2015. If something I need is added to Rust 2018 or a later edition, I'll be forced to update or backport.

fluffything · 6 years ago
> If something I need is added to Rust 2018 or a later edition

Most new language getting added to Rust, are added to the Rust 2015 edition (e.g. NLL). If you need a language feature that is added to a later edition only (like the `try` keyword), that's because the feature is incompatible with code being used in earlier editions (which declared a macro with the keyword name).

You can continue using the macro by just using raw-literal syntax.. but my old Rust code tends to "just work", so I don't really need to update it. My crates are also very small, so if I'd ever need an update, it wouldn't take too long - but haven't had to do that yet, so can't comment.

I tend to write most of my new code on new crates, so I default them to whatever edition was the default when I create them, and never look back.

I have lot of 2015 crates in my dependency tree, and that works just fine.

swalladge · 6 years ago
> If something I need is added to Rust 2018 or a later edition, I'll be forced to update or backport.

Should add that new editions with breaking changes are only expected to happen rarely (iirc every 3 years), a large difference to 6 weeks.

Izkata · 6 years ago
> But that means my code is stuck on Rust 2015.

...can't you upgrade and choose not to make that change? Did something happen to make that not compile?

(not a Rust user)

Deleted Comment

bosswipe · 6 years ago
If you don't update over time there's a danger that you won't be able to interoperate with other software, or you might not be able to take advantage of new features. It's easier to make small changes over time then trying to do a big bang upgrade with several years of changes.
anderskaseorg · 6 years ago
Rust 2015 and Rust 2018 have no trouble interoperating with each other in both directions. If you want to update, that's great, and there are automatic tools to help you, but you don't need to feel compelled to do it by the pace of language development.
typon · 6 years ago
I think its implied that having idiomatic code is better than not having idiomatic code.

Deleted Comment

justinclift · 6 years ago
Unless it wastes people's time every x weeks, just to update to the latest hmmm... "fashion trend" for no practical benefit? :)
_bxg1 · 6 years ago
I'm getting seriously concerned about feature-creep in Rust. I understand that there was an initial period of rapid growth as the community figured out what was needed, and that some of Rust's syntax sugar makes a very real difference in productivity.

But Rust is already not a simple language. It already has long compile times, and some of its syntax sugar already makes it harder to understand what's really going on when you invoke it. I think it's important that the Rust community start reeling in frivolous sugar, otherwise it may just become C++ all over again.

Ar-Curunir · 6 years ago
Can you name some examples of "frivolous sugar"? Also compile times have been a big focus of the compiler team, and have been going down YoY.
_bxg1 · 6 years ago
> Can you name some examples of "frivolous sugar"?

The one mentioned in the article seemed fairly frivolous to me. I don't know if I can name one that's already been accepted into the language which I would call frivolous, per se, though they're all varying degrees of necessary. But most of the "sugar" syntaxes have made the language harder to understand for newcomers, even the ones that are arguably necessary. They all come with a cost.

The ? syntax for Results, for example, rubs me the wrong way a little bit. In that case it really does eliminate a large amount of code and is probably worth the trade-off. But now instead of Results just being a monad that can be picked apart like any other data structure, they become a Language Feature that gets special, magical treatment not expressible by the type system. You just have to know what the question mark translates to underneath. Worthwhile or not, this makes me sad. Async/await is a similar case.

> Also compile times have been a big focus of the compiler team, and have been going down YoY.

Yes but adding complexity to the language immutably increases the difficulty of that task. Even if only by a little bit, it adds debt that will have to be reckoned with for the rest of the language's lifetime.

thomasahle · 6 years ago
Syntactic sugar has been a big point of confusion in my path to learning Rust.

Often I think I have understood something, try to verify by doing the wrong thing, but then because of sy tactic sugar it still works.

Two recent things come to mind:

- Automatic dereferencing, which can dereference arbitrarily long chains of indirection. This makes it hard to figure out which types I have.

- That `match` somehow accepts a reference to an enum, and then magically turns it into an enum over references.

Not that I don't think these will be worth it in the long run, but it makes the language harder to learn.

lightgreen · 6 years ago
Lots of operations on Option and Result for example, and more and more added constantly. They don’t make code readable and it’s hard to remember it and often simple match is easier to write then trying to remember what’s the suitable function exist for the operation.

https://doc.rust-lang.org/std/result/enum.Result.html

xyzzy_plugh · 6 years ago
Yes, this is my concern as well. I used Rust semi-seriously around the time it launched 1.0 (the cake was delicious!) but as an ex-professional C++ dev who loathes C++ very very much, I have a hard time finding Rust any more palatable these days. I'd probably still choose C if I needed to.
_bxg1 · 6 years ago
Rust is still much less complicated than C++ IMO. For now. I'm hoping it doesn't catch up in 20 years.

Deleted Comment

Manishearth · 6 years ago
Not really going to address the rest of the post but I wanted to point out that `impl Trait` hasn't really changed what's idiomatic. People still use generics in argument position, and while I've seen a couple instances of people using impl Trait in argument position it's not enough to call it an idiom shift.

impl Trait in return position has changed how people code; but that's because it made certain things suddenly possible, which isn't an idiom change as much as obsoleting some old bad workarounds.

I'm curious to know why you felt like you had to change your code to be more idiomatic with impl Trait.

----

Nor does it seem like Ok wrapping is the kind of feature that would change what idiomatic Rust is.

Ar-Curunir · 6 years ago
This is an anecdote, but I'm someone who keeps up rather zealously with language updates, and even though I write a lot of generic-heavy code, I don't think my code contains a single instance of `impl Trait` in either argument or return position, across over 60,000 lines of rust code
fluffything · 6 years ago
I guess that depends on how you code.

Do you ever write code that returns, e.g., an `Iterator` ? e.g.

    fn my_map<T: Mul, I: Iter<Item=T>>(it: I, x: T) -> impl Iterator<Item=T> {
        it.map(|i| i * x)
    }
`impl Trait` in return position is the only way to write that kind of code, because you can't name closures. You can workaround this by re-implementing a custom `Map` iterator... Or if you are dealing with `Future`s, by writing a new custom `Future` type, but with `impl Trait`, you don't need to.

I use it a lot. What before required a lot of boilerplate, now is a one liner.