-
Notifications
You must be signed in to change notification settings - Fork 259
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
[SUGGESTION] clarify need for move/forward #221
Comments
It is my understanding that move is a statement of movement of ownership, an important intent to clarify in a language that places the responsibility of memory aloocation and deallocation on the user.
The implementation detail thereafter does lead to a slew or optimisation opportunities, but they are a bonus, not the requirement afaik.
My expertise on forward is lacking, I am also interested to know if it is merely implementation detail or also conveys some intent
On 12 January 2023 08:42:48 Daniel Oberhoff ***@***.***> wrote:
Can someone clarify why move and forward are needed? Seems to me in/out are statements of intent while move/forward are implementation details? Recently saw a talk about the val language and it seems they get a lot of mileage out of just in/inout/out.
—
Reply to this email directly, view it on GitHub<#221>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AALUZQMUBL2V2PCWM7RXNR3WR67YLANCNFSM6AAAAAATY7FSAE>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Hmm, but can a move not be generated in the right place? If I say 'in' it means i want to use this value exclusively, so if it is not used elsewhere anymore the move could be generated, no? In general I am wondering if things like in/inout/out become available isnt that enough to infer the right action, and forward/move become cumbersome details? |
I just reread this paper by HSutter himself If I understand your concern, you're saying that "move" is a subset of "in", which I think it is, some "in" parameters may even be optimised to "move" at compile time, but I think that it is important to give the function writer the choice to force a move, which "in" can't do. I could be wrong about this but: |
Without having a good insight into |
I attempt to answer this in paper d0708, particularly the summary table in section 1.1.2. See also the other resources in README.md > 2020: Parameter passing. The short answer is that writing
And
That's effectively true in Cpp1, and templates are an implementation detail in Cpp2. But one of the things Cpp2 generalizes is that you can easily |
Thank you for the summary! (And to @maddanio for asking) |
Yes Thanks a lot! |
Val also has move parameters, they call it "sink". Just saying |
ah, right, yah, sorry, guess I should have read more before asking...sorry again |
Can someone clarify why move and forward are needed? Seems to me in/out are statements of intent while move/forward are implementation details? Recently saw a talk about the val language and it seems they get a lot of mileage out of just in/inout/out.
The text was updated successfully, but these errors were encountered: