On Monday 15 June 2015 21:01:54 André Pönitz wrote: > if so: > > Please explain how that avoids name clashes.
You only need to add the prefix when the compiler tells you. E.g. if you use QtGui::QTransform in one file and Qt3D::QTransform in another, in the same project, you can write QTransform in both, without ambiguity. Only when you need both in the same TU _and_ you using-direct _both_, you need to prefix QtGui:: or Qt3D::, but only for QTransform, not, say, QAspectThread. > else: > > Please explain how "QFoo::Bar" (or the even longer QtFoo::Bar, > or QFoo::QBar or QtFoo::Bar) is not more onerous than "QFooBar" Purely a matter of personal style. Given that the rest of the world has happily lived with a standard library in namespace std, I fail to see how Qt being inconsistent with the rest of the C++ world on something that is not part of its core competency is something good. How about we make syncqt create a header with typedefs QtFoo::QBar -> QFooBar? :) > > Your "Although we could recommend people to not use using directives we > can't enforce it (nor should we)" indicates a preference for the 'else' > branch (expectedly so), but I'd appreciate to see the reasoning why > having to type '::' (and possibly 't' and a second 'Q') can be seen > positively at all Namespaces partition not only the name space, but also ADL spaces. The larger the project, the more important restricting all-too far-reaching ADL becomes. As a practical example: We could import std::rel_ops into namespace Qt3D, and would never have^Wforget to write op!=, op>, op<= and op>= again anymore, in Qt3D, because they are synthesized from op== and op<, resp. We cannot do that in the global namespace, because it would affect user code. Thanks, Marc -- Marc Mutz <[email protected]> | Senior Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company Tel: +49-30-521325470 KDAB - The Qt Experts _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
