Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2154
TODO list before this becomes ready:
This change wraps a scope around a file (similar to putting an opening brace at the top of the file and a closing one at the bottom) so the file's local variables are really local, and so the functions declared in the file have proper scope captured in their closures.
Doc changes needed:
Note, these will need to be fleshed out with good examples - these sentences below are just bullet-point reminders:
local foo is 1.
orglobal foo is 1.
meant the same thing at the file level. Now they differ as one would expect. lazyglobal will still make globals as it did before when you set an unknown variable name. This only affects what happens when you explicitly saylocal
- now it works - before it just became global anyway because the file has no scope.)local
when you declare it.global
keyword, you now should be able to make a function's name globally call-able, even when it is declared deeply nested in other things (this is consistent with using 'global' for variable identifiers). It will still have local scope closure inside its body, however. (This used to not be allowed - theglobal
keyword was forbidden for function declarations.)