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

Simon Hausmann Simon.Hausmann at qt.io
Wed Feb 26 14:32:48 CET 2020


Am 26.02.20 um 13:42 schrieb Tor Arne Vestbø:
>> We’re neither enforcing the use of ‘emit’ currently. And I honestly find most of the alternatives to be worse than no annotation at all.
> I agree.
>
> As others have argued, a signal is not special, in the sense that any function can do anything, including emitting signals, so annotating it doesn’t seem critical, as we apparently are fine without in all other cases.
>
> 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.

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" :-)


Simon



More information about the Development mailing list