-
Notifications
You must be signed in to change notification settings - Fork 127
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
The _detail
and _internal
namespace should be the last one in the chain of namespace following SDK design precedence
#6120
Comments
I have fairly strong feelings about this rule - the "_detail" and "_internal" being terminal namespaces can be incredibly limiting - it precludes the ability to express internal-only C++ namespaces - namespaces which should NEVER be exposed to customers. For instance, this rule requires that the RustInterop namespace (which should NEVER be exposed to customers) appears as a direct child of Azure::Core::Amqp - and that implies that the RustInterop namespace is intended to contain public types (and top level public types as well). It would be incredibly easy to accidentally forget to put the types in that namespace in the _detail sub-namespace and thus accidentally expose those types. But by putting the entire RustInterop namespace under a _detail namespace, it means that it is much harder to accidentally expose types in that namespace. For both of the But it doesn't necessarily make sense for |
That's a very interesting point. Thanks for sharing the concrete example motivating an exception where requiring _internal/_detail as a terminal namespace can pollute the set of public namespaces. Would it be okay with you if I propose the wording in the C++ guidelines to capture the nuance of our stance, and drive this conversation to conclusion? I think we can carve out a reasonable exception to the rule. |
FYI, the additional nuance you shared @LarryOsterman (for the exception cases) would need to be reconciled with our previous guidance when we designed and shipped v1:
#### Detail namespaces
The detail namespace is implementation that is internal to the package (i.e. service). These are implementation details and can change at any time without notice.
DO NOT expose `::_detail` namespace to customers in public headers or return types. Where possible the _detail namespaces should reside in private headers.
Each package can define _detail namespace(s) as they see fit under one condition. The _detail namespace must be the last namespace in the namespace chain.
Example:
`<service>::<somenamespace>::_detail` is valid
`<service>::_detail::<somenamespace>::` is invalid |
I'd be interested in seeing that rule. My personal version of it is (which is mostly consistent with previous guidance):
The 3rd bullet encapsulates the current guidance, except for the final sentence (which I assert is excessively limiting). Note that the final bullet generates an ApiView error if violated. |
I can't recall why we settled on this being the "final" part of the namespace. It does seem overly restrictive. |
IIRC at a time we discussed them, there was no strong reason for We could at least say, until there is no |
Yeah, I remember looping thru this issue for a while and having everyone agree on the structure and valid usage of it. |
We currently have types in headers that are in the
_detail
namespace which contain sub-namespaces likeCryptography
.azure-sdk-for-cpp/sdk/tables/azure-data-tables/inc/azure/data/tables/internal/cryptography/url_encode.hpp
Line 12 in 0e699e4
The existing precedence in the SDK is that
_detail
/_internal
is the last component of the namespace.See examples:
azure-sdk-for-cpp/sdk/core/azure-core/inc/azure/core/internal/cryptography/sha_hash.hpp
Line 18 in 0e699e4
azure-sdk-for-cpp/sdk/core/azure-core/inc/azure/core/internal/credentials/authorization_challenge_parser.hpp
Lines 15 to 16 in 0e699e4
cc @RickWinter
The text was updated successfully, but these errors were encountered: