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

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Fri Feb 21 14:00:16 CET 2020


Il 21/02/20 12:49, Julien Cugnière ha scritto:
> Isn't that true of any function call though ? Any function could end
> up deleting this, or trigerring code in another thread, or anything.
> For example, a normal function call could end up emiting a signal, and
> as such, any function could be as dangerous as a signal.

Not really: for functions you call explicitly, you know their 
preconditions and postconditions. printf is not going to delete this, 
and malloc is not going to reenter another function of your object while 
you're mutating the state risking to find garbage.

The big difference with signal emission is that they don't generally 
impose anything at all (preconditions, implementation, postconditions) 
on the slots being connected, in the name of loose coupling. As someone 
reasoning on the code emitting the signal, the annotation that control 
is leaving and anything can happen at that point is a positive ε of 
valuable information.

> The other problem with emit, is that it's not required. So its absence
> doesn't mean a signal is not being emitted.

Sure, but that's why Clazy is angry about emit missing in front of a 
signal call, or if someone puts emit in front of something that is not a 
signal.

-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200221/884fd67d/attachment-0001.bin>


More information about the Development mailing list