Skip to content
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

Rework some wording around out and inout parameters #312

Merged

Conversation

llvm-beanz
Copy link
Collaborator

This somewhat future proofs some aspects of the language here by saying that [in]out parmaeter initialization is copy-initialization, but the writeback assignment is assignment. That allows for clarity around overloaded operators so that the argument life becomse something like this:

auto &ArgTmp = (Arg); // Evaluate the argument expr saving it.
T Param = ArgTmp;     // Copy-initialize Param with Arg's result.
call(Param);          // Call the function.
ArgTmp = Param;       // Assign back the Param result with =.

This somewhat future proofs some aspects of the language here by saying
that [in]out parmaeter initialization is copy-initialization, but the
writeback assignment is _assignment_. That allows for clarity around
overloaded operators so that the argument life becomse something like
this:

```
auto &ArgTmp = (Arg); // Evaluate the argument expr saving it.
T Param = ArgTmp;     // Copy-initialize Param with Arg's result.
call(Param);          // Call the function.
ArgTmp = Param;       // Assign back the Param result with =.
```
Copy link
Collaborator

@coopp coopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@llvm-beanz llvm-beanz merged commit 7d83acd into microsoft:main Sep 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants