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

no call to Base.rest if vararg is all-underscore #38403

Merged
merged 3 commits into from
Nov 13, 2020

Conversation

simeonschaub
Copy link
Member

I just noticed that a, _... = b still contains a call to Base.rest after lowering, which we probably don't want, especially if we eventually decide to go with #37132. This just skips all-underscore varargs during destructuring.

@simeonschaub simeonschaub added the compiler:lowering Syntax lowering (compiler front end, 2nd stage) label Nov 11, 2020
(st (gensy)))
`(block
(local ,st)
,.(if (> n 0) `((local ,st)) '())
Copy link
Member Author

Choose a reason for hiding this comment

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

() = a actually currently produces a dangling NewVarNode, which I guess is not a big deal, especially since it's a pretty contrived example, but I guess avoiding this doesn't hurt?

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Yeah it's worth removing the unused NewvarNode.

src/julia-syntax.scm Outdated Show resolved Hide resolved
src/julia-syntax.scm Outdated Show resolved Hide resolved
@JeffBezanson
Copy link
Sponsor Member

This is perfectly fine, but I remain opposed to #37132 in the strongest possible terms. It's pure user harassment. In _..., the tail is allowed to be empty, so that change amounts to telling people that the syntax a, b = f(x) now has to be a, b, _... = f(x) for no reason. That's because the latter will always work, but the former will now sometimes error, so to be safe (especially when updating your code to placate the awakened beast) you have to write the latter one. And it just seems strange to have to announce that you are not using some values. Do I have to go to amazon.com right now and tell them that I am not ordering a shower head?

@simeonschaub simeonschaub merged commit 28ff641 into master Nov 13, 2020
@simeonschaub simeonschaub deleted the sds/rhs_slurping_all_underscore branch November 13, 2020 10:30
@StefanKarpinski
Copy link
Sponsor Member

The real question is why aren't you ordering a new shower head?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants