-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Lifetime guide refactoring #14172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lifetime guide refactoring #14172
Conversation
or C++ reference. | ||
|
||
Unlike C and C++ compilers, the Rust compiler includes special static | ||
checks that ensure that programs use references safely. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular motivation for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to get rid of the "managed and exchange heap" concept.
However, I can see that I deleted an important things like:
- the Rust compiler includes special static checks that ensure that programs use references safely.
- working with references helps reduce the overhead of automatic memory management.
Sidenote:
A goal I have in mind is to change the guides to use the words "pointers" and "references" consistently. Given that a references != pointer. Correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would agree with that, yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question.
A reference is as flexible as a C pointer or C++ reference.
In what ways ? I don't think we should compare references with C pointers. It's confusing for the new comers (assuming they are the targeted audience).
Also:
the core concepts will be familiar to anyone who has worked with C or C++
afaik the community is not interested in the dynamic languages new comers, should we really exclude them this bad ?
What's your opinion ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we really exclude them this bad
This is a perpetual question. The current answer is "assume people have systems experience, and let's create some helper stuff to get non-systems people up to speed."
I don't see this language as exclusionary, I see it was "for more, check out this concept in C or C++." Though maybe changing it to simply say that will be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
After reading the comment today I think I was being very dramatic. Small changes in phrasing can make a difference though.
Thanks for the feedback <3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. :) You're totally right, small changes can matter.
hey @steveklabnik I wonder if you could provide some input on something. I was going through the pointers guide and I think there are lots of overlapping concepts. I'm starting to think that merging both guides would make sense. Also, in the pointers guide, I believe there's an important mix of concepts that could be confusing. Again, since pointers != references, I don't think the guide is using the correct wording. Note that the ideas behind it are correct. Thanks : ) |
There are overlapping concepts, but I think it's a big and important enough topic to have its own guide. |
Closing and will reopen briefly with full changes. |
Still a work in progress but interested in early feedback.
#13987