-
Notifications
You must be signed in to change notification settings - Fork 1.5k
File concatenation principle #6031
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
base: trunk
Are you sure you want to change the base?
Conversation
Carbon uses syntax to denote the start of a library or package, which functions | ||
at the top of a file or in the middle of a file in the same way. Language rules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't really true. You are only allowed to put the header lines before other declarations, and only once. I think the idea should be closer to saying that there should be a purely mechanical process for combining two files.
code in either file. It will be required to order the concatenation so that | ||
dependencies are ordered first, in order to maintain the information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may be worth saying a bit more about imports. Can adding imports lead to ambiguities that create diagnostics?
accumulation principle. There is always an ordering that allows any Carbon | ||
project to be fully concatenated into a single Carbon source file and thus built | ||
with a single compiler invocation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have a plan to support multiple packages in a single file.
recreate and distribute a bug repro or to build a piece of C++ code in an | ||
environment without the requirement of a build system. This allows code taken | ||
from any build environment to be easily compiled by a developer in any other | ||
environment, through a single compiler invocation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also mention minimization?
Co-authored-by: josh11b <[email protected]>
Co-authored-by: josh11b <[email protected]>
Co-authored-by: Carbon Infra Bot <[email protected]>
Co-authored-by: Carbon Infra Bot <[email protected]>
project to be fully concatenated into a single Carbon source file and thus built | ||
with a single compiler invocation. | ||
|
||
## Applications of these principles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add something about the example that led us to forming the principle?
We propose a principle that it's always possible to concat together Carbon source files without changing the meaning of or diagnostics applied to the code.