Namespaces in libkdecore

Frerich Raabe raabe at kde.org
Sun May 2 15:10:35 BST 2004


On Saturday 01 May 2004 19:57, Scott Wheeler wrote:
> On Saturday 01 May 2004 19:17, Thiago Macieira wrote:
> > While talking to some other developers, it seems that the use of
> > namespaces throughout KDE libraries is a wanted feature, despite the
> > fact that it would break source compatibility.
>
> It needn't break source compatibility.
>
> namespace KDE {
>   namespace UI {
>     class LineEdit;
>   }
> }
>
> typedef KDE::UI::LineEdit KLineEdit;

It'll already cost you an arm and a leg to convince people to go from 
"KLineEdit" to "KDE::LineEdit", the extra "UI" step is total overkill IMHO 
(what's next - KURL becomes "KDE::Core::URL"?).

> Or as I would prefer:
>
> namespace KDE3 {
>   typedef KDE::UI::LineEdit KLineEdit;
> }

What such a versioned namespace could be good for is totally beyond me.

> Then people could pretty easily make things work with a "using namespace
> KDE3;"

Doesn't that make you wonder what the switch to nested namespaces gained you, 
if people can simply import the whole namspace and get on with life?

From what I can see, the original assumption that namespaces are a wanted 
feature is bogus, and unless I get to see a few compelling reasons to ::-ify 
the sources I'm not convinced of it.

- Frerich




More information about the kde-core-devel mailing list