-
Notifications
You must be signed in to change notification settings - Fork 444
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
Clean up P4C namespaces #4707
Comments
I'm starting to use P4C as a library at work, and this has come up as a major issue. In the short term, in order to minimize downstream code changes, I wonder if it makes sense to introduce an extra top-level namespace After this refactoring, I guess figuring out a clearer namespace policy can be left as a longer term issue to solve over time. |
Currently, most things in the compiler should be in one of a few namespaces:
|
We could make a PR to get started with this and then see what breaks etc. |
Sure, I can draft a PR for this. |
Just want to have some further discussion regarding #4825 and follow-ups. My goal for #4825 is to serve as a good starting point for further clean-ups. The diffs are intentionally kept as small and straightforward as possible, leaving a lot of room for further improvements. So after #4825 is merged, maybe we could do one round of more careful review & refactoring on a per-subdirectory basis? If there are a few of us available for this work, I propose that we coordinate in advance who will review which subdirectory, so we can approach this in parallel, and don't double the work by accident. What does everyone think? |
Any concrete cleanups you have in mind? I can do this ad-hoc for P4Tools at the very least. |
Some concrete items I can think of now:
In general, I feel that once we start going over each directory more carefully, we might be able to identify more namespace issues or room for further cleanups. Also, I can sign up to review the following directories that I feel I have a relatively good understanding of:
|
Reopen as this issue is not fully resolved. Keep it to track further namespace cleanups. |
Feel free to edit the original post to create an umbrella issue or create an entirely new one. |
Please update https://github.com/p4lang/p4c/blob/main/.gdbinit to call |
Addresses p4lang#4707 (comment). Signed-off-by: Bili Dong <[email protected]>
Addresses p4lang#4707 (comment). Signed-off-by: Bili Dong <[email protected]>
Addresses #4707 (comment). Signed-off-by: Bili Dong <[email protected]>
Created #4931 for this. I think the original question of having a clearer policy on namespaces is still not addressed yet. Maybe discussion on that can continue here. Adding a doc (or a section in an existing doc) to explain P4C's namespace policy might be a realistic action item to close this issue. |
Our namespace policy is a little unclear. Currently, we seem to use P4 for front/mid end, ControlPlaneAPI for the control plane, and IR for the IR code. The lib folder has no namespaces.
This namespace policy makes it more difficult to link P4C as a library and also introduce elements that can be used across the entire compiler framework without polluting the global namespace.
It might be worthwhile to step back and figure out a clearer policy on namespaces. The difficulty is that any changes to the core code will be a major breaking change.
The text was updated successfully, but these errors were encountered: