[Development] Namespaces (was: Qt Platform Extras)

Stephen Kelly stephen.kelly at kdab.com
Fri Oct 25 13:55:37 CEST 2013


On Sunday, September 22, 2013 13:21:34 Sze Howe Koh wrote:

> * Aside from the namespaces we've been discussing recently, there is
> another kind of namespace in unreleased modules. These are associated
> with the Q_BEGIN_NAMESPACE_<MODULE> macros. They cover everything in
> the module, including classes and other namespaces (e.g. QtOrganizer,
> QtBluetooth, QtNfc)
> 
> * QtBluetooth and QtNfc were recently removed in preparation for the
> modules' Qt 5.2 release

Yes, the only reason that the namespaces remain in the qtpim repo is that that 
repo is dormant and no releases are planned from it.
 
> // PROPOSALS:
> + Prefer namespaces over stateless classes (thinking of QX11Info)

I agree in general. Namespaces can't accidentally be used in method APIs.

> + All standalone module functions should be placed in a namespace
> (thinking of qNfcChecksum())

I agree in general. This has always been the case for Qt::escape.

> // QUESTIONS:
> ? Will we ever want more namespaced classes?

Perhaps, but I don't think that matters currently.

> ? What is the Qt Project's position on Q_BEGIN_NAMESPACE_<MODULE>?

I was sure we agreed to remove those and replace them with Q_BEGIN_NAMESPACE.

Eg:

 https://codereview.qt-project.org/#change,64737


> // PROPOSALS:
> + Make all new Qt 5 namespaces "QFoo" to match current namespaces.
> Change everything together in Qt 6.

I agree on the Qt 5 stuff. The Qt 6 stuff is for the future.


> Should a header that's named after a namespace contain classes that
> aren't part of the namespace? (No, IMHO)
> 
> >>     #include <QDBus>
> > 
> > Doesn't exist.
> > 
> >>     #include <QGL>
> > 
> > Doesn't exist.
> 
> Right. Something needs fixing then. What's the preferred fix?
> (a) Remove those headers from documentation (e.g.
> http://qt-project.org/doc/qt-5.1/qtdbus/qdbus.html), or

I'd say remove from the docs.

Thanks for trying to push for a resolution and consistency here!

-- 
Join us in November at Qt Developer Days 2013 - https://devdays.kdab.com

Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131025/1ab0680e/attachment.sig>


More information about the Development mailing list