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

Precompiled gensyms are not unique #44903

Closed
cstjean opened this issue Apr 7, 2022 · 1 comment · Fixed by #45182
Closed

Precompiled gensyms are not unique #44903

cstjean opened this issue Apr 7, 2022 · 1 comment · Fixed by #45182
Labels
docs This change adds or pertains to documentation

Comments

@cstjean
Copy link
Contributor

cstjean commented Apr 7, 2022

On Julia 1.7, the first gensym you get at the REPL is going to be Symbol("##274"), even if you've imported packages that contain that symbol. Witness:

module TestPkg
g = gensym()
end # module

then

julia> using TestPkg
[ Info: Precompiling TestPkg [9db6ce8c-046d-11e9-3d6b-c5272c17d34a]

julia> TestPkg.g
Symbol("##274")

julia> TestPkg.g == gensym()
true

Obviously this is a pretty rare problem, but for context, we thought that

@gensym f
@eval MyModule $f() = ...

couldn't possibly overwrite a method in MyModule. Turns out this is false because of this issue. It's been a very painful bug to figure out.

Semi-related: #18172

@vtjnash vtjnash added the docs This change adds or pertains to documentation label Apr 7, 2022
@vtjnash
Copy link
Member

vtjnash commented Apr 7, 2022

They are unique to the containing module only, and we possibly cannot do better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants