-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
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
added
the
design idea
An issue recording a specific language design idea that folks can potentially pick up.
label
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. |
This was referenced Oct 20, 2022
jonmeow
changed the title
Design idea: optional package name in
Design idea: optional Oct 20, 2022
package
and import
package
keyword and optional package name in package
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.
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:/carbon-language/carbon-lang/blob/trunk/docs/design/README.md#package-declaration
If the package name is omitted, as in
package library "Main" api;
, thefile 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 belongingto 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
filesusing a
package impl;
package declaration.The text was updated successfully, but these errors were encountered: