-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
correct docstring for gensym
#60064
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
base: master
Are you sure you want to change the base?
correct docstring for gensym
#60064
Conversation
| gensym([tag]) | ||
| Generates a symbol which will not conflict with other variable names (in the same module). | ||
| Generate a symbol unique among all calls to this function within the same process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that it is definitely not unique among names in the process (as the failed tests show), but only from context of defining one module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why I said "calls within the process". What I'm trying to say is that all calls to this within one process will return different names (different from each other, not necessarily different from anything else). I think that's all we can promise? I don't see how it involves modules except in that packages are precompiled in separate processes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern is that people will not think about precompile as being a separate process (nor do we want them to have to think much about it being implemented in that way). Thus a module is intended to be the user concept that is the smallest unit at which julia may launch a separate process to handle this detail. But the fact it is a separate process seems like it should be an implementation detail, while the definition of the function should try to be independent of that, and instead written to reflect the user-facing implication of that: which is that any given module can only generate names unique to top level module (as defined at the process level by the implementation of precompile)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding an explicit warning, e.g. "note that packages might be compiled in separate processes, so names will not be unique between load time and run time"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a lot more accurate than connecting it with modules, since you can run into this problem within one module, not just between them.
c159c4d to
2f1c196
Compare
No description provided.