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

Should it be valid to define a package named r#Core? #4908

Open
zygoloid opened this issue Feb 6, 2025 · 1 comment
Open

Should it be valid to define a package named r#Core? #4908

zygoloid opened this issue Feb 6, 2025 · 1 comment
Labels
leads question A question for the leads team

Comments

@zygoloid
Copy link
Contributor

zygoloid commented Feb 6, 2025

Summary of issue:

Now that Core is a keyword, we can support both a package named Core and a package named r#Core in the same program, and these would be distinct packages. Should this be permitted?

Details:

In favor of permitting it:

  • If we later add a new special package name, the r# form would allow existing colliding packages to retain their names. This might be a concern for special package names such a C or Rust.

In favor of disallowing it:

  • Avoids confusion about which package Core is meant.
  • Avoids the need to distinguish between package Core and package r#Core in name mangling etc.

Any other information that you want to share?

No response

@zygoloid zygoloid added the leads question A question for the leads team label Feb 6, 2025
@danakj
Copy link
Contributor

danakj commented Feb 6, 2025

My reading of #4864 was that the goal was specifically to not claim any realestate from developers and allow them to use any word in their own programs. By using builtins, it allows the r# form to always be used instead. It seems at odds with that to not allow packages named r#Core but also it could be confusing - and we could say that we allow other things named r#Core just not packages. Are packages special in this way? Because there's no packages in C++ or some other reason? Or Is Core special?

github-merge-queue bot pushed a commit that referenced this issue Feb 11, 2025
Change representation of package names from `IdentifierId` to
`PackageNameId`, and add a special value `PackageNameId::Core` for the
Core package. Add a `Core` expression to name the Core package, and
support for parsing the `Core` keyword in `package` and `import`
declarations.

For now, I've made no changes to instruction fingerprinting or name
mangling. This means that fingerprints and mangled names will collide
between names in the `Core` package and names in a `r#Core` package. See
#4908.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
leads question A question for the leads team
Projects
None yet
Development

No branches or pull requests

2 participants