-
-
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
more predictable global binding resolution #18933
Comments
Yep, this would make #265 easier. |
I would fix this in the process of #265 then since I think the more dynamic behavior is undesirable. |
The flip side of this issue is that if you do julia> module A
x = 1
export x
end
A
julia> module B
using A
end
B
julia> B.x # should maybe be undefined instead
1 This is probably less of a problem, however. |
Yes, we could potentially "seal" the module from bringing in new things visible via |
An interesting aspect of this is how |
This changes the meaning of `global` from being a directive when used at toplevel, which forces the introduction of a new global when used in certain contexts, to always being just an scope annotation that there should exist a global binding for the given name. fix #18933 fix #17387 (for the syntactic case)
This changes the meaning of `global` from being a directive when used at toplevel, which forces the introduction of a new global when used in certain contexts, to always being just an scope annotation that there should exist a global binding for the given name. fix #18933 fix #17387 (for the syntactic case)
This changes the meaning of `global` from being a directive when used at toplevel, which forces the introduction of a new global when used in certain contexts, to always being just an scope annotation that there should exist a global binding for the given name. fix #18933 fix #17387 (for the syntactic case)
This changes the meaning of `global` from being a directive when used at toplevel, which forces the introduction of a new global when used in certain contexts, to always being just an scope annotation that there should exist a global binding for the given name. fix #18933 fix #17387 (for the syntactic case)
@JeffBezanson and I discussed this one (a long while ago) and I could have sworn I'd opened an issue about it, but I can't find it so perhaps I didn't. Whether a binding comes from a
using
or not should be predictable from the content of a module, not what is done with the module. Example:Currently, we can, in two separate Julia sessions, have
B.x
either be an import fromA
or be a global binding fromB
, depending on what the caller does:Session 2:
Arguably, the definition of the function
x!
which assignsB.x
should causeB.x
not to refer toA.x
, rather than the evaluation ofx!
causing that binding to occur. Thus, in the first case,B.x
when occurring before any call toB.x!
should be an undefined reference. This may not be worth bothering with, but it could make life easier for static compilation and I really doubt many people are depending on the current behavior. cc @vtjnashThe text was updated successfully, but these errors were encountered: