[Development] A modest proposal: disable lower-case keywords (emit, foreach, forever, signals, slots) by default

Alex Blasche alexander.blasche at qt.io
Wed Feb 26 17:26:14 CET 2020


> -----Original Message-----
> From: Development <development-bounces at qt-project.org> On Behalf Of
> Simon Hausmann

Please don't generalise where there is no general or even majority count (see below).

> Am 26.02.20 um 13:42 schrieb Tor Arne Vestbø:
> > We don’t need one rule to rule them all either. Many signals are named
> fooChanged(), and can perfectly well stand on their own, without annotations.
> Corner cases like "emit pressed();” can be annotated with Q_EMIT or a comment
> to make it clearer what’s going on.

Some end with "Changed". The overwhelming amount does not follow this rule and we won't change the naming for Qt 6 either. The naming convention merely states that there is a verb at the end. 

 
> This is also what tipped me over. We have stronger conventions nowadays with
> property based APIs and the Changed suffix for the corresponding signals. We'll
> be fine without "emit" :-)

Another case of generalisation where there is none. QML may have that notation but C++ doesn't. Now I don't know whether you plan to enforce such a rule for the new object property system but I would argue forcing every object property signal to end with "Changed" might be a bit too much. Last but not least, not every signal is associated to a property either.

--
Alex



> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development


More information about the Development mailing list