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

Konstantin Tokarev annulen at yandex.ru
Wed Feb 26 14:41:10 CET 2020



26.02.2020, 16:34, "Simon Hausmann" <simon.hausmann at qt.io>:
> 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" :-)

FWIW, not all signals in world have corresponding properties.

-- 
Regards,
Konstantin



More information about the Development mailing list