-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
disallow 'global x' when x exists in outer scope #11985
Conversation
This is changing code, so not a very good candidate for that? Stefan upgraded to a second worker so the queue is completely caught up now. |
This change seems like a good idea.
|
LGTM 👍 |
@tkelman I want to tweak the error message a little bit, and will let av run before merging. Will add NEWS entry too, I guess. (it would be bizarre for this to affect Windows only, but I suppose stranger things have happened. Good to know that we have more queue space now) |
Regarding @ihnorton's comment "ideally this ought to work". I think maybe it shouldn't as it would be confusing. Is there any situation where Also, maybe the error message could read: `variable "z" is a local variable in the enclosing scope." as it was not declared local. |
will do. I can't think of a counter-example that would necessitate allowing this, On Thu, Jul 2, 2015 at 1:26 PM, Mauro [email protected] wrote:
|
You're right about the inconsistency, but probably this is good enough. |
I'm a big fan of consistency, but sometimes other considerations are more important, which I think is the case here. |
disallow nested 'global x' if x is local variable in enclosing scope
This is a bit odd:
but probably nothing to worry about. |
Why is it odd? |
Sorry, I should have been more clear: it's just the error message that could be better in this case. As far as the user is concerned, there is no "enclosing scope" which could have locals as it is the global scope. (I suspect that under the hood the function arguments are in a local scope and the body is then a nested local scope of that.) |
Changes Unknown when pulling 9a4c0d8 on ihn/re7264 into ** on master**. |
Why are we getting these every once in a while? |
Coveralls hash collision is my guess. |
"fixes" #7264
before:
after:
I guess ideally this ought to work, but at least giving an error makes the problem obvious immediately.
Alternatively, if someone can suggest how to pass the annotation through I'll try to implement that.(
...remember the variable and emit a a lambda when compiling the assignment block?edit: ick, nevermind. that would be order-dependent)