[Development] Qt 6: inline namespace Qt
giuseppe.dangelo at kdab.com
Fri Sep 6 18:04:09 CEST 2019
Il 06/09/19 16:27, Mutz, Marc via Development ha scritto:
> Let's name the options, as I see them (new additions welcome!):
> ([NS::] in the below means that namespace is inline)
> A) We can keep the existing Qt namespace, then types would be named
> [Qt::]Qt::Alignment, [Qt::]QString, [Qt::]QLineEdit, which, in the first
> case, is a bit funny but would only show up in the debugger.
> B) Same as (A), but we flatten the existing namespace Qt into the new
> inline namespace Qt. This is what I propsed in OP: [Qt::]Alignment,
> [Qt::]QString, [Qt::]QLineEdit.
> C) I don't think you can have two namespace blocks with the same name
> and have one inline and the other not, but if you can, then we could
> erect the new inline namespace Qt ex the current non-inline one:
> Qt::Alignment, [Qt::]QString, [Qt::]QLineEdit.
> D) Alternatively, we can go the extra mile and make a per-library inline
> namespace, ex the current non-inline Qt namespace: Qt::Alignment,
> [QtCore::]QString, [QtWidgets::]QLineEdit.
> I'd still ask to first try (B). The name clashes are entirely
> theoretical atm, and when and if they unexpectedly become a source of
> problems, we still have the option to go with (A), (C), or (D).
I was actually proposing option A, to avoid clashes. The Qt:: namespace
at the moment is simply too big to reasonably claim that there will be
no conflicts. A few examples that come into mind: Qt::horizontal,
Qt::vertical, Qt::[color name], Qt::SHIFT, Qt::Monday, Qt::XAxis.
Option C does not work, a namespace is either entirely inline or it's not.
Thanks for bringing this up,
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4329 bytes
Desc: Firma crittografica S/MIME
More information about the Development