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

Implement unexporting variables #2098

Merged
merged 16 commits into from
Jun 5, 2024
Merged

Implement unexporting variables #2098

merged 16 commits into from
Jun 5, 2024

Conversation

neunenak
Copy link
Contributor

@neunenak neunenak force-pushed the 1263-unset branch 4 times, most recently from ac8531a to e3137c8 Compare May 28, 2024 08:59
@neunenak neunenak marked this pull request as ready for review May 28, 2024 09:00
@casey
Copy link
Owner

casey commented May 29, 2024

Just took a look at this, mostly looks good. I think we should call this unexport, since unset sounds like it has something to do with settings.

There are a few tests we should have:

  • Duplicate unexport statements should be an error. If people want duplicate unsets, for whatever reason, maybe because they're importing them from modules, we can relax this, but can't change things in the opposite direction, i.e., make duplicate an error when it hadn't been before.
  • Having an export and unexport for the same variable should be an error. Similarly, this is easy to relax in the future, but we couldn't later make it an error if it wasn't one before.
  • Recipes can export parameters with foo $VAR: syntax. I'm inclined to not make this an error, and we should have a test which checks that if you unexport a variable at the top level, but export it in a function parameter, it gets set.

@casey casey marked this pull request as draft May 30, 2024 08:07
@casey casey marked this pull request as ready for review May 30, 2024 08:07
Copy link
Owner

@casey casey left a comment

Choose a reason for hiding this comment

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

Doing an actual review so it shows up as requested changes in my PR lists.

@neunenak neunenak changed the title Implement unsetting variables Implement unexporting variables Jun 2, 2024
@neunenak neunenak requested a review from casey June 2, 2024 18:36
Copy link
Owner

@casey casey left a comment

Choose a reason for hiding this comment

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

Dope, LGTM!

Did some very minor stuff. For example, you can do ${VAR:-unset}, to allow figuring out if a variable is unset without triggering an error, which is useful for tests.

@casey casey enabled auto-merge (squash) June 5, 2024 20:14
@casey casey merged commit 38873dc into casey:master Jun 5, 2024
5 checks passed
@neunenak neunenak deleted the 1263-unset branch August 25, 2024 09:41
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.

2 participants