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

Sérgio Martins sergio.martins at kdab.com
Fri Feb 21 13:58:38 CET 2020


On 2020-02-21 12:41, Ville Voutilainen wrote:
> On Fri, 21 Feb 2020 at 14:30, Mitch Curtis <mitch.curtis at qt.io> wrote:
> 
>> > > without any annotation is not what we want. We'd miss vital information
>> > and reduce readability.
>> > Can you please explain what that vital information is?
>> How can you tell if it's a signal being emitted or just a function 
>> call without the emit syntax? With the emit syntax before the signal 
>> emission, it's immediately obvious that it's a signal. Not all signals 
>> follow the *Changed() naming convention, nor should they, so it 
>> becomes even less obvious in those cases.
> 
> Why do I need to know that it's a signal being emitted? How is that
> "vital information"? I could just as well
> invoke any other callback, but I find myself not exactly yearning for
> being able to write
> callback somethingHappened();


Signals have different semantics than regular functions.

If I'm reading the body of makePlane() I can ignore the signal 
emissions, as they aren't important for how a plane is made, they just 
inform whoever is listening.

And I'd argue that the emitter shouldn't even know who or how many slots 
are connected to the signal, might even be zero, it shouldn't matter.

If you really need to execute a piece of code, call a normal function, 
don't emit a signal.





Regards,
-- 
Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Experts


More information about the Development mailing list