carbon-lang
carbon-lang copied to clipboard
Design idea: optional `package` keyword and optional package name in `package`
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
apifile 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 multipleimplfiles using apackage impl;package declaration.
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.
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.