-
Notifications
You must be signed in to change notification settings - Fork 484
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
Proposal: namespaces for global variables #1102
Comments
Good idea. To be clear, it doesn't seem that you are proposing simply a If so, it would be good to agree on what those namespaces should be early on instead of adding them in later to avoid re-work. Here are my suggestions for the global categories, with explanation if needed:
|
Exactly, having a few categories would help keep things straight. I was thinking:
|
"Namespaces are one honking great idea -- let's do more of those!" I agree that the settings namespace is very helpful. I fully endorse putting all of our global variables in one namespace or another. |
FYI, I have a branch where I've taken care of this that I'm planning on putting a PR in for after #1118 is merged. |
Adopted with the merging of #1120 |
I've found it really useful to have global variables be members of a namespace below
openmc::
. For example, when moving all settings-related variables to C++, I put them in aopenmc::settings::
namespace. The big benefit is that when they are used around the code, it's a lot more obvious what is a global variable and what is not because the global variables have a namespace prefix. In fact, with our existing rules, it makes everything unambiguous:nothing_special
use_trailing_underscore_
somens::global_var
@openmc-dev/committers What do others think about adopting this as a formal rule going forward?
The text was updated successfully, but these errors were encountered: