Skip to content

Conversation

@JeffBezanson
Copy link
Member

No description provided.

@JeffBezanson JeffBezanson added the docs This change adds or pertains to documentation label Nov 6, 2025
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.
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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)

Copy link
Member Author

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"?

Copy link
Contributor

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.

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 this pull request may close these issues.

4 participants