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

Design idea: optional package keyword and optional package name in package #2323

Open
jonmeow opened this issue Oct 20, 2022 · 2 comments
Open
Labels
design idea An issue recording a specific language design idea that folks can potentially pick up. long term Issues expected to take over 90 days to resolve.

Comments

@jonmeow
Copy link
Contributor

jonmeow commented Oct 20, 2022

There are several provisional ideas which were added by @josh11b to the design overview. I'm filing this to track the ideas.

Key sections are:

https://github.com/carbon-language/carbon-lang/blob/trunk/docs/design/README.md#package-declaration

  • If the package name is omitted, as in package library "Main" api;, the
    file contributes to the default package. No other package may import from
    the default package.

  • If a file has no package declaration at all, it is the api file belonging
    to the default package and default library. This is particularly for tests
    and smaller examples. No other library can import this library even from
    within the default package. It can be split across multiple impl files
    using a package impl; package declaration.

@jonmeow jonmeow added the design idea An issue recording a specific language design idea that folks can potentially pick up. label Oct 20, 2022
@jonmeow
Copy link
Contributor Author

jonmeow commented Oct 20, 2022

Leads approved the overview update in #1347 so I assume this doesn't need to be a leads question, but it wasn't really discussed there so a specific design would be good.

@jonmeow jonmeow changed the title Design idea: optional package name in package and import Design idea: optional package keyword and optional package name in package Oct 20, 2022
@jonmeow
Copy link
Contributor Author

jonmeow commented Oct 20, 2022

It was noted that #1136 comments on making package names optional on import, and that's really covered by #2001, so I'm trimming this down to be specific to the package keyword.

jonmeow added a commit that referenced this issue Oct 20, 2022
…onal. (#2324)

I've filed #2323 to track the design idea for `package`, and #2001 already tracked `import`, but these should be explicitly marked as provisional.
@josh11b josh11b added the long term Issues expected to take over 90 days to resolve. label Dec 21, 2022
github-merge-queue bot pushed a commit that referenced this issue Jul 6, 2023
Make the preamble of simple programs more ergonomic, by removing the
`package Main` from the main package and removing the `package`
declaration
entirely from the main source file. Imports within a single package no
longer
need to, and are not permitted to, specify the package name.

Partially covers #2001 / #1136.
Covers #1869.
Supersedes #2265.
Addresses design idea #2323.

---------

Co-authored-by: Jon Ross-Perkins <[email protected]>
Co-authored-by: josh11b <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design idea An issue recording a specific language design idea that folks can potentially pick up. long term Issues expected to take over 90 days to resolve.
Projects
None yet
Development

No branches or pull requests

2 participants