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

Name binding is confusing #293

Open
lgalfaso opened this issue Jan 2, 2025 · 1 comment
Open

Name binding is confusing #293

lgalfaso opened this issue Jan 2, 2025 · 1 comment

Comments

@lgalfaso
Copy link
Contributor

lgalfaso commented Jan 2, 2025

The section "Name binding and variables" is confusing, this reads (bold added by myself):

Nested beneath the predeclared block is the module block, which contains the bindings of the current module. Bindings in the module block (such as a, b, c, and h in the example) are called global and may be visible to other modules. The module block is empty at the start of the file and is populated by top-level binding statements, but an application may pre-bind one or more global names, to provide domain-specific functions to that file, for example.

Nested beneath the module block is the file block, which contains bindings local to the current file. Names in this block (such as a and b in the example) are bound only by load statements. The sets of names bound in the file block and in the module block do not overlap: it is an error for a load statement to bind the name of a global, or for a top-level statement to bind a name bound by a load statement.

Reading the parts in bold. Based on the first paragraph a and b are bind at the module block, and as such are called globals. Based on the second paragraph, a and b are bind at the file block. Also based on the second paragraph, my reading is that the module block and file block should not overlap and that it is an error if they do. Given that based on the reading, all load statements would bind to both module block and file block then this should cause an error.

@lgalfaso
Copy link
Contributor Author

lgalfaso commented Jan 2, 2025

A possible fix would be to specify that load statements should only bind to the file block, and specify that both the module block and file block are visible from other modules. I think that other possible fixes are available, but not as simple to explain.

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

No branches or pull requests

1 participant