Future language ergonomics

I was hyped for rust 1.65, because I had a use-case for GATs that I thought was pretty neat. But as it has turned out, in practice the thing that mostly affected my day-to-day Rust work in 1.65 was the let-else statements. I don't know if it's just the way I tend to express things, but I use it .. well, I would probably be exaggerating if I said "every day", but the fact that I'm even stretching for that phrase should be some kind of indicator. I use it a lot.

It has made me curious about what other ergonomics changes have been proposed. Is there an easy way to find "officially" suggested syntax changes (that are primarily for ergonomics)?

2 Likes

First, you'll need to define "official". But so many people come up with so many suggestions/ideas that it's practically impossible to keep track of all of them. You can read IRLO, but TBH it's not worth it. There's a lot of noise, because empirically, most of the ideas arise out of a lack of understanding of the language, and are consequently subpar and not really well-designed. You can come across the occasional gem, but it's rare. You can also read the Rust-lang RFC repo directly, which is perhaps a little higher quality, overall. Still an enormous amount to read through, so be prepared for that.

5 Likes

I don't think there is any general way to search for proposed ergonomic improvements. The best I can see is to look at the list of tracking issues in the Rust repo. Tracking issues exist to track progress of implementation and stabilization of accepted RFCs. However, I don't see any way to select only ergonomic improvements, and the category is quite nebulous anyway (is get_many_mut an ergonomic improvement? is assert_matches?). You'd have to manually check the open issues to see what interests you.

One feature that has been close for a while is let chains. It was proposed for stabilization a few months ago, but unfortunately some last-minute issues were discovered. I would still expect it to land in the next few months.

if let guards can also be a nice QoL improvement for pattern matching.

try blocks would be a major improvement to ergonomics of Result handling if it lands. I wouldn't hold my breath though, it's been stuck since 2016.

The recently accepted RFC on C-string literals can be a pretty big improvement to ergonomics of FFI. I wouldn't expect it within the next year, since the implementation haven't even started, but it doesn't look like a feature likely to be unstable for too long.

generators and async generators would be a huge improvement to the ergonomics of writing iterators and async streams. Unfortunately, it's basically untouched designwise, so it's a very long way off.

async closures would be a small but notable improvement to the ergonomics of async code.

Related, async traits are a pretty big improvements to async coding, and now that GATs were stabilized, we should expect to see (at least non-dynamic) async traits in a reasonable timeframe.

16 Likes

Lists issues proposed for stablilization.

6 Likes

I've also been using let ... else constantly since upgrading -- it's great for parsing -- and similarly had no idea that it was going to be so handy. It's made me more skeptical of my (and everyone else's) ability to evaluate language changes in the abstract.

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.