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

Document assignment destructuring #30579

Merged
merged 10 commits into from
Apr 22, 2021
Merged

Document assignment destructuring #30579

merged 10 commits into from
Apr 22, 2021

Conversation

simonbyrne
Copy link
Contributor

This doesn't appear to be documented elsewhere in the manual.

@simonbyrne simonbyrne added the docs This change adds or pertains to documentation label Jan 4, 2019
@JeffBezanson
Copy link
Member

The feature is introduced a few lines below this, where it says Julia supports simple tuple "destructuring" that facilitates this:. We could just add a note there that the syntax actually works with all iterators. It is also called "destructuring assignment", not "assignment destructuring".

@simonbyrne
Copy link
Contributor Author

I've updated to address @JeffBezanson's coments (prompted by discussion on discourse).

I've moved some of the underscore discussion to variables, but it does occur to me that the whole destructuring issue is orthogonal to functions: ideally we would have an assignment section elsewhere (perhaps under variables or scoping?), but until then this seems to be the best place for it.

@simonbyrne
Copy link
Contributor Author

bump?

@vtjnash
Copy link
Member

vtjnash commented Apr 20, 2021

I believe this is good, but now requires an update for #37410 also, which seems to have landed without docs. Would you be willing to take another pass through?

@vtjnash
Copy link
Member

vtjnash commented Apr 20, 2021

See also #31765

@simonbyrne
Copy link
Contributor Author

@vtjnash @simeonschaub Thanks for the comments, I have updated the PR.

@vtjnash vtjnash requested a review from JeffBezanson April 20, 2021 16:34
@vtjnash
Copy link
Member

vtjnash commented Apr 21, 2021

This should perhaps also be combined with #30579

@simonbyrne
Copy link
Contributor Author

@vtjnash this is #30579

@vtjnash
Copy link
Member

vtjnash commented Apr 22, 2021

How about #38125 then 😬?

@simonbyrne
Copy link
Contributor Author

I added the points mentioned by @JeffBezanson in #38125 (comment).

Copy link
Member

@simeonschaub simeonschaub left a comment

Choose a reason for hiding this comment

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

Some small suggestions, but otherwise LGTM.

doc/src/manual/functions.md Show resolved Hide resolved
doc/src/manual/functions.md Outdated Show resolved Hide resolved
doc/src/manual/functions.md Show resolved Hide resolved
@simonbyrne simonbyrne merged commit 2c88fb7 into master Apr 22, 2021
@simonbyrne simonbyrne deleted the sb/assignment branch April 22, 2021 18:52
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
* Document assignment destructuring
* Add reference to slurping assignment (JuliaLang#37410)
* mention swapping variables and other kinds of LHS

Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Simeon Schaub <simeondavidschaub99@gmail.com>
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
* Document assignment destructuring
* Add reference to slurping assignment (JuliaLang#37410)
* mention swapping variables and other kinds of LHS

Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Simeon Schaub <simeondavidschaub99@gmail.com>
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
* Document assignment destructuring
* Add reference to slurping assignment (JuliaLang#37410)
* mention swapping variables and other kinds of LHS

Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Simeon Schaub <simeondavidschaub99@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants