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

Rename "Line" and related usages to Closure? #35

Open
arichard4 opened this issue Nov 1, 2021 · 4 comments
Open

Rename "Line" and related usages to Closure? #35

arichard4 opened this issue Nov 1, 2021 · 4 comments

Comments

@arichard4
Copy link

I found this extremely confusing when looking through the code- many usages of the word "line", and in particular the class "Line" from linearize.lua, are actually referring to a function or file scope, not a single line.

Unfortunately this isn't the same as a scope in general, as it doesn't create a new "Line" class for e.g. stepping inside an if branch; it's mostly just one scope/"Line" class per function, but with an additional one for the file's scope.

Does this sound right to ya'll? I'm not very familiar with the luacheck code, so I might be misunderstanding.

@arichard4
Copy link
Author

arichard4 commented Nov 1, 2021

Also, I'm curious if there's a better/shorter/clearer name for this. "scope" and "block" aren't quite right. "A block is the body of a control structure, the body of a function, or a chunk (the file or string with the code where the variable is declared)." A line in this case is the body of a function or the chunk, but not the body of a control structure.

@alerque
Copy link
Member

alerque commented Mar 25, 2022

Is "closure" the word you're looking for here?

@arichard4
Copy link
Author

Yes!

@arichard4 arichard4 changed the title Rename "Line" and related usages to FunctionOrFileScope? Rename "Line" and related usages to Closure? Apr 11, 2022
@alerque
Copy link
Member

alerque commented Apr 11, 2022

Yes, I think using the correct terminology here would be a good idea. Even for somebody unfamiliar with the term 'closure', using the wrong term 'line' just because it happens to be a familiar word isn't helping anybody, only making things more confusing. Better to have to look up the term and then understand what is going on than be mislead by our usage.

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

No branches or pull requests

2 participants