[Qt-creator] Use of namespaces in Qt Creator's own code

Oswald Buddenhagen oswald.buddenhagen at digia.com
Tue Jul 9 16:28:19 CEST 2013


On Tue, Jul 09, 2013 at 03:50:06PM +0200, Ziller Eike wrote:
> On 09.07.2013, at 13:35, Oswald Buddenhagen <oswald.buddenhagen at digia.com> wrote:
> > On Tue, Jul 09, 2013 at 12:51:51PM +0200, Ziller Eike wrote:
> >> I don't see the point, Qt doesn't use namespaces at all. So going the Qt way would be to remove all namespacing...
> >> 
> > orly?
> 
> Ok, there are. They are just not widely used. So the requirement that
> "components" in Qt Creator are in a namespace is already non-Qt.
> 
http://qt-project.org/wiki/Creating-a-new-module-or-tool-for-Qt#03fa1e2be330cf40074c0a55dafe27c4

> >>> to solve the clash problem, there are two approaches:
> >>> - use an additional convention (ugly)
> >>> - FooNames::Foo
> >>> - Foo::FooClass
> >>> - remove the redundancy
> >>> - Foo::Plugin
> >> 
> >> The clash is with things like CppEditor::CppEditor.
> >> 
> > maybe the problem is the namespace name then?
> > the vcs plugins don't have any suffix. maybe the same should be done for
> > the laguage plugins.
> 
> CppEditor is not one of the language plugins, that is CppTools. CppEditor is really the plugin that contains only all the editor related code.
> Similar with BinEditor::BinEditor, DiffEditor::DiffEditor.
> 
ok, whatever. it's still backwards: it should be Cpp::Editor. or
whatever. but the namespace clearly contains more than only the editor.

> > or, because the namespace belongs to the plugin, name it
> > CppEditorPlugin. of course this would then produce
> > CppEditorPlugin::Plugin …
> 
> That would lead to all namespaces having the redundant "Plugin" postfix.
> 
it's not redundant. it's just noisy.

> I just don't know why to go through hoops instead of just going for lowercase namespaces. These would also be visually profoundly distinct from the class naming.
> It looks to me like the only "contra" against lowercase namespaces that we are currently talking about is "it's non-qt" which I find arguable.
> 
foo = cppeditor::CppEditor::staticFunction()

looks as beautiful as stl ... no, actually worse, as it's mixed.

On Tue, Jul 09, 2013 at 05:53:30PM +0400, Konstantin Tokarev wrote:
> 09.07.2013, 15:35, "Oswald Buddenhagen" <oswald.buddenhagen at digia.com>:
> > yet another option would be "big endian" notation for the plugin names:
> > EditorCpp, VcsGit, ProjectManagerQmake, etc.
> 
> Actually, what you describe is "little endian"
> 
no, it's not. the most significant (top-level namespace) bytes are at
the lowest addresses (leftmost).
all natural number notations i'm aware of are also big-endian.
calendar date notations are arbitrary ...




More information about the Qt-creator mailing list