[Development] Some Qt3D feedback

Sean Harmer sean.harmer at kdab.com
Thu Jun 18 13:13:16 CEST 2015


On Thursday 18 Jun 2015 10:51:01 Smith Martin wrote:
> Do you also advocate rules for using namespaces in Qt? What rules does KDE
> use?
> >From following this thread, the rules that seem natural to me would be:
> 1. For a new module, either put everything in a namespace or don't use a
> namespace at all. 

Fine by me.

> 2. If you put everything in a namespace:
> 2.1 The name of the namespace should begin with Qt, e.g. Qt3D.

Agreed.

> 2.2 The classes in the namespace should not be prefixed with Q.

This one I could see the benefit of still using a Q so that if people do use 
using namespace QtBlah the code still looks like Qt code. However, I know 
Thiago say's that's their problem and that Lars said he doesn't like the 
repeated Q. So I'm happy to go with the consensus here.

> 3. In the documentation for the namespace, recommend that, for readability,
> users should not use using.

I'm not sure I'd bother mentioning that as user's can make their own minds up 
and using a using directive doesn't stop anything from working, it's purely 
stylistic until you need to disambiguate but those cases should be quite rare, 
at least for the near future.

So, in summary, I'm happy to make those changes to Qt3D.

Cheers,

Sean

> 
> martin
> 
> ________________________________________
> From: development-bounces+martin.smith=theqtcompany.com at qt-project.org
> <development-bounces+martin.smith=theqtcompany.com at qt-project.org> on
> behalf of Marc Mutz <marc.mutz at kdab.com> Sent: Thursday, June 18, 2015 1:32
> PM
> To: development at qt-project.org
> Subject: Re: [Development] Some Qt3D feedback
> 
> On Thursday 18 June 2015 11:37:48 Knoll Lars wrote:
> > >Curiously, you didn't list any pro-namespace arguments. I don't know what
> > >to  make of this, but I fear that a decision is being made based solely
> > >on arguments from one side.
> > 
> > So what are the arguments from your point of view then? Apart from
> > namespaces being in fashion.
> 
> If this was about fashion, then namespaces have been fashionable since at
> least the early 2000s (std::, boost::).
> 
> Pro namespaces:
> 
> - It's the standard way of partioning the name space. C++ users understand
> it, the C++ language understands it, and the C++ compiler does, too.
> 
> - namespaces act as an ADL barrier (did you ever got lost in the error
>   compilers spew out when you get a simple == wrong? they rival template
> error messages, and the reson is that they're all put into the global
> scope).
> 
> - related: they provide a module-wide C++ scope (std::rel_ops example)
> 
> - you cannot (meaningfully) use inline namespaces for versioning (an option
> we should at least consider) if you don't have a namespace in which to put
> them.
> 
> - the user has the option of whether she wants to be explicit or convenient.
> Qt trying to impose this decision on its users by name prefixing is a)
> ignoring the fact that many users I know (QtC, KDE(pim)[1], to name the
> biggest and most well-known), liberally use using-directives and do just
> fine. The standard books teach this, too.
>   b) preposterous. Imagine your OS took away your hierarchical filesystem
> and required you to type
>          $EDITOR homelarsdevQt5qtbasesrccorelibkernelqobject.h
>      every time. How long until you'd go mad? But hey, you cannnot _not_ see
> the path of each file, even when someone pastes it on the internet. But
> this is what you're imposing on your users. It's ok as long as it was just
> Q. That's cute. But QDesignerCustomWidgetCollectionInterface or
> QDeclarativeNetworkAccessManagerFactory is *NOT* cute. It's ridiculous.
> 
> [1] And no-one, not even QtC, uses so many libraries as KMail does. If you
> are looking for namespace experience, look there.
> 
> Thanks,
> Marc
> 
> --
> Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
> KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
> Tel: +49-30-521325470
> KDAB - The Qt Experts
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

-- 
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts



More information about the Development mailing list