[Development] Namespaces (was: Qt Platform Extras)

Nurmi J-P jpnurmi at digia.com
Mon Sep 16 12:49:13 CEST 2013


On Sep 14, 2013, at 2:56 AM, Sze Howe Koh <szehowe.koh at gmail.com> wrote:

> On 11 September 2013 01:07, Laszlo Papp <lpapp at kde.org> wrote:
>> On Tue, Sep 10, 2013 at 4:46 PM, Thiago Macieira <thiago.macieira at intel.com>
>> wrote:
>>> 
>>> On terça-feira, 10 de setembro de 2013 22:31:53, Sze Howe Koh wrote:
>>>> On 10 September 2013 14:27, Knoll Lars <Lars.Knoll at digia.com> wrote:
>>>>> Ok, let's use QtWin for the namespace. For the module itself it makes
>>>>> IMO
>>>>> to keep the 'Extras' in the name.
>>>>> 
>>>>> Cheers,
>>>>> Lars
>>>> 
>>>> QtWin or QWin?
>>> 
>>> QtWin, it's a namespace.
>> 
>> 
>> I believe he is aware of that...
>> 
>> I think, Sze please correct me if I am wrong, he just wanted to make sure
>> because there was several emails last year about QFoo or QtFoo for the
>> namespace, and it seemed that the suboptimal naming was chosen for other
>> reasons.
> 
> Laszlo is correct.
> 
> Before Qt 5 was released, most public namespaces had the "QFoo" format
> -- QSsl, QDBus, QAudio, etc. A few had the "QtFoo format --
> QtMultimedia::MetaData (unreleased), QtMultimedia (unreleased), and
> QtConcurrent. I suggested making them uniform. [1]
> 
> Lars said that he preferred "QFoo" -> "QtFoo", but that change was the
> much more intrusive one. Qt 5 was close to Beta 2 at the time, so he
> chose the lower-risk "QtFoo" -> "QFoo". [2]
> 
> As of Qt 5.1, all public namespaces are "QFoo", except "Qt" and
> "QtConcurrent". Thiago blocked the latter on the basis that (i)
> development on that module has stopped, and (ii) QtConcurrent is quite
> different from all the other namespaces anyway. [3]
> 
> With all that in mind, do we want "QtWin" or "QWin"? The benefit of
> "QWin" is consistency with existing conventions; the downside is
> having to wait till Qt 6 if we want to switch to the preferred
> "QtFoo". "QtWin" has the benefit of introducing users to the preferred
> naming convention now (and a smaller list of namespace changes if/when
> the change occurs), at the cost of introducing more inconsistencies.
> 
> I vote for "QWin" for consistency, and I'm not sure that an extra
> ':%s/QWin::/QtWin::/g' will make a difference to users if they're
> doing the same for all other namespaces in Qt 6.

Consistent or not, do we want to introduce more namespaces with suboptimal names? IMHO it would be better to go for the optimal naming with new namespaces, and eventually fix the old remaining ones in Qt 6. That would give us cute names and less changes needed in the future while porting to Qt 6.

One could also argue whether for example the QSsl namespace is that bad after all. The scope of that particular namespace is to provide enums for a small set of SSL classes, whereas namespaces like QtWin and QtMac are module-wide. To me it would make sense to enforce the QtFoo naming convention for such module-wide enums, but still allow QFoo style naming for "targeted" namespaces.

--
J-P Nurmi




More information about the Development mailing list