rust-lang / book

The Rust Programming Language

Home Page:https://doc.rust-lang.org/book/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(wording) Chapter 4: To take and give back ownership vs take and pass on ownership

julix-unity opened this issue · comments

  • I have searched open and closed issues and pull requests for duplicates, using these search terms:
    • "Takes"
    • "takes_and_gives_back"

URL to the section(s) of the book with this problem: Chpt 4 here

Description of the problem: the naming takes_and_gives_back left me as a Rust newb uncertain if s2 was "still" invalidated or somehow ownership was given back.

Suggested fix: It's more precisely takes_and_passes_on, right?

I might be wrong about that being more clear (given that the line has been as is for 4 years without complaints) - but I figured I'd still mention it.

Thanks for flagging it! This is one of those fun spots in English where I can totally see what you are seeing here. I can see a bunch of different names here, including takes_and_returns, but I think they all have ambiguity in some direction or another. takes_and_passes_on might imply that it hands ownership off internally, for example, while both takes_and_gives_back and takes_and_returns might imply there is something going on with the original s2 binding (as you raised). I don’t think there is any clear win here. 😓 Thanks again for opening it, though! Always appreciated.