[Development] Qt UDL operators
sona.kurazyan at qt.io
Tue Apr 5 14:28:39 CEST 2022
> From: Giuseppe D'Angelo <giuseppe.dangelo at kdab.com>
> Il 04/04/22 15:53, Sona Kurazyan ha scritto:
> > I see two main issues with keeping both:
> > - If we want to add UDLs with same names for different domains in future,
> adding the "q"-prefixed counterparts will be problematic. For example, let's
> say we want to add Qt::inline Literals::inline OtherDomain::_s, what should
> be the "q"-prefixed version of it? We can name it to something like _qXs,
> where X is some domain specific letter, but it will require even more typing,
> and make the name inconsistent with Qt::inline Literals::inline
> I'm not sure how this work: unless the new _s takes another kind input
> (e.g. number literals), you can't add it no matter what, as users under
> "using namespace Qt;" would then get a conflict...?
Right, it will work only if the types of the literals with the same name differ, so we can add e.g. _s for seconds (or something else) in future.
> > - We will have multiple ways of doing the same thing, and I assume, it might
> be confusing for users.
> Sure thing, that's why I'm OK at deprecating one of the two.
I'll wait a bit more, to make sure that there are no more concerns/objections against deprecating _qX and adding their counterparts to Qt::StringLiterals, and merge https://codereview.qt-project.org/c/qt/qtbase/+/401308/ and https://codereview.qt-project.org/c/qt/qtbase/+/401604/.
More information about the Development