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

Funny interaction between `set -ql` and `if` #2502

Closed
ridiculousfish opened this Issue Oct 23, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@ridiculousfish
Member

ridiculousfish commented Oct 23, 2015

set -l foo bar
if set -ql foo
  echo Found it
end

This does not echo "Found it" like one might expect. I guess the if statement introduces a new scope which contains the condition, so the local variable is not found. But even so, it really seems like this ought to succeed.

set -ql should probably check up to the function boundary.

@ridiculousfish ridiculousfish modified the milestones: fish-future, next-2.x Oct 23, 2015

@ridiculousfish ridiculousfish added the docs label Oct 23, 2015

@ridiculousfish

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish Oct 23, 2015

Member

I want to make set -ql basically mean "check up to function scope" instead of "just check the local scope." I can't think of any reasonable use case for checking just the local scope, since you always know what variables you defined in the local scope. Therefore there's no compatibility risk. This is a little asymmetric but I think it's very natural.

This change needs to be mentioned in the release notes.

Member

ridiculousfish commented Oct 23, 2015

I want to make set -ql basically mean "check up to function scope" instead of "just check the local scope." I can't think of any reasonable use case for checking just the local scope, since you always know what variables you defined in the local scope. Therefore there's no compatibility risk. This is a little asymmetric but I think it's very natural.

This change needs to be mentioned in the release notes.

@faho faho added the release notes label Oct 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment