You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think span should be declared and defined in boost::core:: so that one may write core::span when inside the boost namespace. We should still lift it into the enclosing boost:: namespace, so this is in addition to not in lieu of. This should not break anything.
One big reason to place components into more compartmentalized namespaces is avoiding unintended conflicts caused by ADL. When a type is likely to be passed as function or template parameters, or used as a base class, you don't want it to pull lots of unrelated stuff from wide namespaces, such as boost.
why would we want to do this for existing components?
I want to reiterate that this proposal does not break anything. The reason we want to do this for existing components is for teaching/documentation. It is better to see core::span in header files and documentation rather than span or boost::span as this makes the origin of the symbol clear and unambiguous.
Existing code deeply nested in the boost namespace can still utter span if it wants to, with the ambiguities it brings. Or authors can opt-in to less ambiguity by writing core::span (my preference) or the more wordy boost::core::span.
Lately I have been writing system::error_code and core::string_view instead of using aliases to those types in my own namespace for clarity, as when you have N libraries each providing aliases for error codes, string views, and other things, the result is unergonomic.
Activity
glenfe commentedon May 26, 2025
I can understand doing this for new components in Core, but why would we want to do this for existing components?
Lastique commentedon May 26, 2025
One big reason to place components into more compartmentalized namespaces is avoiding unintended conflicts caused by ADL. When a type is likely to be passed as function or template parameters, or used as a base class, you don't want it to pull lots of unrelated stuff from wide namespaces, such as
boost.vinniefalco commentedon May 26, 2025
I want to reiterate that this proposal does not break anything. The reason we want to do this for existing components is for teaching/documentation. It is better to see
core::spanin header files and documentation rather thanspanorboost::spanas this makes the origin of the symbol clear and unambiguous.Existing code deeply nested in the
boostnamespace can still utterspanif it wants to, with the ambiguities it brings. Or authors can opt-in to less ambiguity by writingcore::span(my preference) or the more wordyboost::core::span.Lately I have been writing
system::error_codeandcore::string_viewinstead of using aliases to those types in my own namespace for clarity, as when you have N libraries each providing aliases for error codes, string views, and other things, the result is unergonomic.glenfe commentedon May 26, 2025
That sounds fine; I have no objection to it.