Live data from Hacker News

Five Years of Rust

blog.rust-lang.org

91–100 of 133 posts

Re: Five Years of Rust

#91

The progress on the error messages truly is worth highlighting, and kudos to the team for all the hard work there. It's one of the hardest things to get right in a programming language, particularly if that language has a fussy compiler.

For an example of how good it is, I recently just renamed one go source file to .rs and rand the compiler again and again while fixing the errors it gave me and managed to get a working rust program at the end.

Re: Five Years of Rust

#92
post #19

Earlier quoted context omitted.

I think more interesting would be something we're truly stuck with (at least until Rust 2.0, which may never come).

(Stuff that’s deprecated in the standard library is stuff we’re stuck with; they cannot be removed in editions.)

Could a lint check for them and warn if some code uses them?

This way slowly the ecosystem could move and stuff could be eventually removed.

Re: Five Years of Rust

#93

Earlier quoted context omitted.

I've been complaining for a long time that `Drop` is fundamentally wrong. Rust's "just write a new function" fixed C++'s "construction is mutation of location", but Rust's Drop makes the same mistakes as C++: destruction needs to be for consuming data, not borrowing it and mutating it. Now, we can't just do drop (T) because of DSTs, so we we'll need a new type of consuming reference. And the dual to that, an initiali…

> but Rust's Drop makes the same mistakes as C++: destruction needs to be for consuming data, not borrowing it and mutating it. but Rust's drop isn't for that purpose. It's not for the actual cleanup of the struct and its children it is for additional cleanup before the children are deleted. So it has to be mutable. The compiler synthesizes the "delete children" code. (I don't understand your point about drop )

> It's not for the actual cleanup of the struct and its children it is for additional cleanup

I think that purpose is the tail wagging the dog, an explanation of the current method rather than an actual requirement.

The simpler thing to do is just have drop on the aggregate calls drop on the fields, just as new on the aggregate can call new on the fields.

Re: Five Years of Rust

#94

I hope Rust adds the major anticipated features (GATs, const generics, specialization) soon, or alternatively decides to not implement them altogether. I'm a rather new Rust developer, but still I very quickly ran into the issue of needing a nightly version of rustc because one of my dependencies (PyO3) relied on one of these features. It would be awesome to have some periodic updates from the compiler team on the pr…

Technically speaking, those are implemented, just not stabilized, if you’re using them in the nightly, they’re just disabled in stable. So I would anticipate they will eventually stabilize like many other features have and become part of stable.

GAT and specialization still needs a lot of magic, mostly chalk/polonius integration, doesn't it?

Re: Five Years of Rust

#95

I hope Rust adds the major anticipated features (GATs, const generics, specialization) soon, or alternatively decides to not implement them altogether. I'm a rather new Rust developer, but still I very quickly ran into the issue of needing a nightly version of rustc because one of my dependencies (PyO3) relied on one of these features. It would be awesome to have some periodic updates from the compiler team on the pr…

Technically speaking, those are implemented, just not stabilized, if you’re using them in the nightly, they’re just disabled in stable. So I would anticipate they will eventually stabilize like many other features have and become part of stable.

Just want to clarify that an implementation being present in nightly doesn't ensure a timeline for stabilization or even that it will happen, as unexpected bugs in the implementation or design of the original RFC might crop up once it's actually used that makes us take the decision to push the stabilization back. This has happened multiple times (from a single version delay to things that are perma-unstable). That being said, the majority of the unstable features you're waiting for "only" need baking time.

Re: Five Years of Rust

#96

Earlier quoted context omitted.

Is there a meaningful help that a Rust beginner can provide here?

Many tickets are scored with a difficulty, and sometimes comes with a mentor: https://github.com/rust-lang/rust/labels?q=E- I think there are meaningful things a beginner can do. I'd be surprised if improving error messages would be terribly hard. And working on the small issues will help you become familiar enough to help with the bigger things. Edit: Also perhaps a way to get some exposure to the rust compiler is t…

The D-papercut diagnostics tickets are in my mind a great source of these kind of newcomers tasks, as some are quite small and don't require full context of the codebase.

Re: Five Years of Rust

#97
post #92

Earlier quoted context omitted.

(Stuff that’s deprecated in the standard library is stuff we’re stuck with; they cannot be removed in editions.)

Could a lint check for them and warn if some code uses them? This way slowly the ecosystem could move and stuff could be eventually removed.

If you use something that's deprecated, you get a warning, yes.

> could be eventually removed.

It can not be used according to our stability policy. There's a lot of closed source Rust out there.

Re: Five Years of Rust

#98
post #59
post #34

Earlier quoted context omitted.

Rust is barely a moving target since 1.0. If you only read the version releases it might seem so, but for the pragmatic programmer not much is changing. Many of the changes concern very special features that only a few libraries make use of. As a library user you don't need to learn them. I learned Rust a few years ago and without keeping up with the latest changes too much I still feel confident I can work on curren…

Having these "very special features" means that there are some things with are added to the language but rarely used. That means that you might come across code in a library that you don't understand, especially if you're not using those features in your own code. So, I think the argument that "very special features" shouldn't be counted toward language complexity/growth is wrong, IMO. I would even say that there nee…

If you look at the changes and cathegorize them they all fall in one if three camps:

- sugar for quality of life improvements that benefits everyone (like ? or NLL)

- new feature that lets you do something that couldn't be done before (like impl Trait or global allocators)

- new feature that removes a special case of the semantics that can be extrapolated from already present features (like associated consts and subslice patterns)

Re: Five Years of Rust

#99
post #92

Earlier quoted context omitted.

Could a lint check for them and warn if some code uses them? This way slowly the ecosystem could move and stuff could be eventually removed.

If you use something that's deprecated, you get a warning, yes. > could be eventually removed. It can not be used according to our stability policy. There's a lot of closed source Rust out there.

There has been talk on the internals forum of "gating" deprecated parts of the std on a new edition. So the deprecated feature will be hidden for crates that declare `edition = '2030'` but will be available for crates using an older edition. Essentially turning the warning into an error.

But this is just talk at the moment. Currently there is no mechanism to implement this. It would also be a challenge for documentation.

Re: Five Years of Rust

#100
post #59

Earlier quoted context omitted.

Having these "very special features" means that there are some things with are added to the language but rarely used. That means that you might come across code in a library that you don't understand, especially if you're not using those features in your own code. So, I think the argument that "very special features" shouldn't be counted toward language complexity/growth is wrong, IMO. I would even say that there nee…

I'd say having special features is ok, as long as these criteria are met: 1) It's obvious the feature is being used. 2) The feature is easy to look up without knowing what it's called, just based on how it's been used. 3) It's easy to understand what the feature actually does, with the appropriate context.

The ? operator doesn't fulfill at least two of the three points, yet it's way more loved than hated. As a general guideline I agree with your points, but it is not to be taken as rigid gospel either.
Post reply on HN