[newchem-cpp] Introduce GRIMPL_NS macro
#482
Open
+132
−56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A lightweight PR that introduces the
GRIMPL_NSandGRIMPL_NAMESPACE_DECLmacros.Description
The basic idea is that we will gradually replace
grackle::implthat is used to open a namespace block withGRIMPL_NAMESPACE_DECL. After the replacement, a namespace block looks like:grackle::implwill be replaced withGRIMPL_NSAs a part of this PR I demonstrated what this will look like in the
ceiling_species.hppfile.The impetus for doing this sooner rather than later is to start using the macros in newly created C++ files.
Motivation
These macros are inspired by similar macros used to define LLVM's implementation of the standard C library.
I provided really detailed docstrings explaining why we want this but it essentially boils down to
GRIMPL_NSlets us renamegrackle::implnamespace. This affords a few benefits (with the benefit of hindsight, I slightly regretgrackle::implas a name, and it's probably important for distributing Grackle as Header-Only library). It's also goes hand-in-hand with theGRIMPL_NAMESPACE_DECLmacroGRIMPL_NAMESPACE_DECLmacro is a relatively elegant way to control symbol visibility in shared librariesOther thoughts
I generally think that introducing
GRIMPL_NSis a good idea. But, if you aren't convinced, I could remake the PR withoutGRIMPL_NAMESPACE_DECL.